diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/CHANGELOG.md b/sdk/resourcemanager/apimanagement/armapimanagement/CHANGELOG.md index d2139ad7cc6c..7903397aca53 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/CHANGELOG.md +++ b/sdk/resourcemanager/apimanagement/armapimanagement/CHANGELOG.md @@ -1,5 +1,433 @@ # Release History +## 2.0.0-beta.1 (2023-06-08) +### Breaking Changes + +- Function `*ContentItemClient.CreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, string, *ContentItemClientCreateOrUpdateOptions)` to `(context.Context, string, string, string, string, ContentItemContract, *ContentItemClientCreateOrUpdateOptions)` +- Function `*ContentTypeClient.CreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, *ContentTypeClientCreateOrUpdateOptions)` to `(context.Context, string, string, string, ContentTypeContract, *ContentTypeClientCreateOrUpdateOptions)` +- Operation `*PolicyClient.ListByService` has supported pagination, use `*PolicyClient.NewListByServicePager` instead. +- Operation `*ProductPolicyClient.ListByProduct` has supported pagination, use `*ProductPolicyClient.NewListByProductPager` instead. + +### Features Added + +- New value `APITypeOData` added to enum type `APIType` +- New value `ContentFormatOData`, `ContentFormatODataLink` added to enum type `ContentFormat` +- New value `HostnameTypeConfigurationAPI` added to enum type `HostnameType` +- New value `PlatformVersionStv21` added to enum type `PlatformVersion` +- New value `SoapAPITypeOData` added to enum type `SoapAPIType` +- New enum type `AsyncResolverStatus` with values `AsyncResolverStatusFailed`, `AsyncResolverStatusInProgress`, `AsyncResolverStatusStarted`, `AsyncResolverStatusSucceeded` +- New enum type `AuthorizationType` with values `AuthorizationTypeOAuth2` +- New enum type `GatewayListDebugCredentialsContractPurpose` with values `GatewayListDebugCredentialsContractPurposeTracing` +- New enum type `KeyVaultRefreshState` with values `KeyVaultRefreshStateFalse`, `KeyVaultRefreshStateTrue` +- New enum type `LegacyAPIState` with values `LegacyAPIStateDisabled`, `LegacyAPIStateEnabled` +- New enum type `MigrateToStv2Mode` with values `MigrateToStv2ModeNewIP`, `MigrateToStv2ModePreserveIP` +- New enum type `NatGatewayState` with values `NatGatewayStateDisabled`, `NatGatewayStateEnabled` +- New enum type `OAuth2GrantType` with values `OAuth2GrantTypeAuthorizationCode`, `OAuth2GrantTypeClientCredentials` +- New enum type `PolicyFragmentContentFormat` with values `PolicyFragmentContentFormatRawxml`, `PolicyFragmentContentFormatXML` +- New enum type `PortalSettingsCspMode` with values `PortalSettingsCspModeDisabled`, `PortalSettingsCspModeEnabled`, `PortalSettingsCspModeReportOnly` +- New enum type `TranslateRequiredQueryParametersConduct` with values `TranslateRequiredQueryParametersConductQuery`, `TranslateRequiredQueryParametersConductTemplate` +- New function `NewAPIWikiClient(string, azcore.TokenCredential, *arm.ClientOptions) (*APIWikiClient, error)` +- New function `*APIWikiClient.CreateOrUpdate(context.Context, string, string, string, WikiContract, *APIWikiClientCreateOrUpdateOptions) (APIWikiClientCreateOrUpdateResponse, error)` +- New function `*APIWikiClient.Delete(context.Context, string, string, string, string, *APIWikiClientDeleteOptions) (APIWikiClientDeleteResponse, error)` +- New function `*APIWikiClient.Get(context.Context, string, string, string, *APIWikiClientGetOptions) (APIWikiClientGetResponse, error)` +- New function `*APIWikiClient.GetEntityTag(context.Context, string, string, string, *APIWikiClientGetEntityTagOptions) (APIWikiClientGetEntityTagResponse, error)` +- New function `*APIWikiClient.Update(context.Context, string, string, string, string, WikiUpdateContract, *APIWikiClientUpdateOptions) (APIWikiClientUpdateResponse, error)` +- New function `NewAPIWikisClient(string, azcore.TokenCredential, *arm.ClientOptions) (*APIWikisClient, error)` +- New function `*APIWikisClient.NewListPager(string, string, string, *APIWikisClientListOptions) *runtime.Pager[APIWikisClientListResponse]` +- New function `NewAuthorizationAccessPolicyClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AuthorizationAccessPolicyClient, error)` +- New function `*AuthorizationAccessPolicyClient.CreateOrUpdate(context.Context, string, string, string, string, string, AuthorizationAccessPolicyContract, *AuthorizationAccessPolicyClientCreateOrUpdateOptions) (AuthorizationAccessPolicyClientCreateOrUpdateResponse, error)` +- New function `*AuthorizationAccessPolicyClient.Delete(context.Context, string, string, string, string, string, string, *AuthorizationAccessPolicyClientDeleteOptions) (AuthorizationAccessPolicyClientDeleteResponse, error)` +- New function `*AuthorizationAccessPolicyClient.Get(context.Context, string, string, string, string, string, *AuthorizationAccessPolicyClientGetOptions) (AuthorizationAccessPolicyClientGetResponse, error)` +- New function `*AuthorizationAccessPolicyClient.NewListByAuthorizationPager(string, string, string, string, *AuthorizationAccessPolicyClientListByAuthorizationOptions) *runtime.Pager[AuthorizationAccessPolicyClientListByAuthorizationResponse]` +- New function `NewAuthorizationClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AuthorizationClient, error)` +- New function `*AuthorizationClient.ConfirmConsentCode(context.Context, string, string, string, string, AuthorizationConfirmConsentCodeRequestContract, *AuthorizationClientConfirmConsentCodeOptions) (AuthorizationClientConfirmConsentCodeResponse, error)` +- New function `*AuthorizationClient.CreateOrUpdate(context.Context, string, string, string, string, AuthorizationContract, *AuthorizationClientCreateOrUpdateOptions) (AuthorizationClientCreateOrUpdateResponse, error)` +- New function `*AuthorizationClient.Delete(context.Context, string, string, string, string, string, *AuthorizationClientDeleteOptions) (AuthorizationClientDeleteResponse, error)` +- New function `*AuthorizationClient.Get(context.Context, string, string, string, string, *AuthorizationClientGetOptions) (AuthorizationClientGetResponse, error)` +- New function `*AuthorizationClient.NewListByAuthorizationProviderPager(string, string, string, *AuthorizationClientListByAuthorizationProviderOptions) *runtime.Pager[AuthorizationClientListByAuthorizationProviderResponse]` +- New function `NewAuthorizationLoginLinksClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AuthorizationLoginLinksClient, error)` +- New function `*AuthorizationLoginLinksClient.Post(context.Context, string, string, string, string, AuthorizationLoginRequestContract, *AuthorizationLoginLinksClientPostOptions) (AuthorizationLoginLinksClientPostResponse, error)` +- New function `NewAuthorizationProviderClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AuthorizationProviderClient, error)` +- New function `*AuthorizationProviderClient.CreateOrUpdate(context.Context, string, string, string, AuthorizationProviderContract, *AuthorizationProviderClientCreateOrUpdateOptions) (AuthorizationProviderClientCreateOrUpdateResponse, error)` +- New function `*AuthorizationProviderClient.Delete(context.Context, string, string, string, string, *AuthorizationProviderClientDeleteOptions) (AuthorizationProviderClientDeleteResponse, error)` +- New function `*AuthorizationProviderClient.Get(context.Context, string, string, string, *AuthorizationProviderClientGetOptions) (AuthorizationProviderClientGetResponse, error)` +- New function `*AuthorizationProviderClient.NewListByServicePager(string, string, *AuthorizationProviderClientListByServiceOptions) *runtime.Pager[AuthorizationProviderClientListByServiceResponse]` +- New function `*ClientFactory.NewAPIWikiClient() *APIWikiClient` +- New function `*ClientFactory.NewAPIWikisClient() *APIWikisClient` +- New function `*ClientFactory.NewAuthorizationAccessPolicyClient() *AuthorizationAccessPolicyClient` +- New function `*ClientFactory.NewAuthorizationClient() *AuthorizationClient` +- New function `*ClientFactory.NewAuthorizationLoginLinksClient() *AuthorizationLoginLinksClient` +- New function `*ClientFactory.NewAuthorizationProviderClient() *AuthorizationProviderClient` +- New function `*ClientFactory.NewDocumentationClient() *DocumentationClient` +- New function `*ClientFactory.NewGraphQLAPIResolverClient() *GraphQLAPIResolverClient` +- New function `*ClientFactory.NewGraphQLAPIResolverPolicyClient() *GraphQLAPIResolverPolicyClient` +- New function `*ClientFactory.NewPolicyFragmentClient() *PolicyFragmentClient` +- New function `*ClientFactory.NewPortalConfigClient() *PortalConfigClient` +- New function `*ClientFactory.NewProductAPILinkClient() *ProductAPILinkClient` +- New function `*ClientFactory.NewProductGroupLinkClient() *ProductGroupLinkClient` +- New function `*ClientFactory.NewProductWikiClient() *ProductWikiClient` +- New function `*ClientFactory.NewProductWikisClient() *ProductWikisClient` +- New function `*ClientFactory.NewTagAPILinkClient() *TagAPILinkClient` +- New function `*ClientFactory.NewTagOperationLinkClient() *TagOperationLinkClient` +- New function `*ClientFactory.NewTagProductLinkClient() *TagProductLinkClient` +- New function `*ClientFactory.NewWorkspaceAPIClient() *WorkspaceAPIClient` +- New function `*ClientFactory.NewWorkspaceAPIExportClient() *WorkspaceAPIExportClient` +- New function `*ClientFactory.NewWorkspaceAPIOperationClient() *WorkspaceAPIOperationClient` +- New function `*ClientFactory.NewWorkspaceAPIOperationPolicyClient() *WorkspaceAPIOperationPolicyClient` +- New function `*ClientFactory.NewWorkspaceAPIPolicyClient() *WorkspaceAPIPolicyClient` +- New function `*ClientFactory.NewWorkspaceAPIReleaseClient() *WorkspaceAPIReleaseClient` +- New function `*ClientFactory.NewWorkspaceAPIRevisionClient() *WorkspaceAPIRevisionClient` +- New function `*ClientFactory.NewWorkspaceAPISchemaClient() *WorkspaceAPISchemaClient` +- New function `*ClientFactory.NewWorkspaceAPIVersionSetClient() *WorkspaceAPIVersionSetClient` +- New function `*ClientFactory.NewWorkspaceClient() *WorkspaceClient` +- New function `*ClientFactory.NewWorkspaceGlobalSchemaClient() *WorkspaceGlobalSchemaClient` +- New function `*ClientFactory.NewWorkspaceGroupClient() *WorkspaceGroupClient` +- New function `*ClientFactory.NewWorkspaceGroupUserClient() *WorkspaceGroupUserClient` +- New function `*ClientFactory.NewWorkspaceNamedValueClient() *WorkspaceNamedValueClient` +- New function `*ClientFactory.NewWorkspaceNotificationClient() *WorkspaceNotificationClient` +- New function `*ClientFactory.NewWorkspaceNotificationRecipientEmailClient() *WorkspaceNotificationRecipientEmailClient` +- New function `*ClientFactory.NewWorkspaceNotificationRecipientUserClient() *WorkspaceNotificationRecipientUserClient` +- New function `*ClientFactory.NewWorkspacePolicyClient() *WorkspacePolicyClient` +- New function `*ClientFactory.NewWorkspacePolicyFragmentClient() *WorkspacePolicyFragmentClient` +- New function `*ClientFactory.NewWorkspaceProductAPILinkClient() *WorkspaceProductAPILinkClient` +- New function `*ClientFactory.NewWorkspaceProductClient() *WorkspaceProductClient` +- New function `*ClientFactory.NewWorkspaceProductGroupLinkClient() *WorkspaceProductGroupLinkClient` +- New function `*ClientFactory.NewWorkspaceProductPolicyClient() *WorkspaceProductPolicyClient` +- New function `*ClientFactory.NewWorkspaceSubscriptionClient() *WorkspaceSubscriptionClient` +- New function `*ClientFactory.NewWorkspaceTagAPILinkClient() *WorkspaceTagAPILinkClient` +- New function `*ClientFactory.NewWorkspaceTagClient() *WorkspaceTagClient` +- New function `*ClientFactory.NewWorkspaceTagOperationLinkClient() *WorkspaceTagOperationLinkClient` +- New function `*ClientFactory.NewWorkspaceTagProductLinkClient() *WorkspaceTagProductLinkClient` +- New function `NewDocumentationClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DocumentationClient, error)` +- New function `*DocumentationClient.CreateOrUpdate(context.Context, string, string, string, DocumentationContract, *DocumentationClientCreateOrUpdateOptions) (DocumentationClientCreateOrUpdateResponse, error)` +- New function `*DocumentationClient.Delete(context.Context, string, string, string, string, *DocumentationClientDeleteOptions) (DocumentationClientDeleteResponse, error)` +- New function `*DocumentationClient.Get(context.Context, string, string, string, *DocumentationClientGetOptions) (DocumentationClientGetResponse, error)` +- New function `*DocumentationClient.GetEntityTag(context.Context, string, string, string, *DocumentationClientGetEntityTagOptions) (DocumentationClientGetEntityTagResponse, error)` +- New function `*DocumentationClient.NewListByServicePager(string, string, *DocumentationClientListByServiceOptions) *runtime.Pager[DocumentationClientListByServiceResponse]` +- New function `*DocumentationClient.Update(context.Context, string, string, string, string, DocumentationUpdateContract, *DocumentationClientUpdateOptions) (DocumentationClientUpdateResponse, error)` +- New function `*GatewayClient.InvalidateDebugCredentials(context.Context, string, string, string, *GatewayClientInvalidateDebugCredentialsOptions) (GatewayClientInvalidateDebugCredentialsResponse, error)` +- New function `*GatewayClient.ListDebugCredentials(context.Context, string, string, string, GatewayListDebugCredentialsContract, *GatewayClientListDebugCredentialsOptions) (GatewayClientListDebugCredentialsResponse, error)` +- New function `*GatewayClient.ListTrace(context.Context, string, string, string, GatewayListTraceContract, *GatewayClientListTraceOptions) (GatewayClientListTraceResponse, error)` +- New function `NewGraphQLAPIResolverClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GraphQLAPIResolverClient, error)` +- New function `*GraphQLAPIResolverClient.CreateOrUpdate(context.Context, string, string, string, string, ResolverContract, *GraphQLAPIResolverClientCreateOrUpdateOptions) (GraphQLAPIResolverClientCreateOrUpdateResponse, error)` +- New function `*GraphQLAPIResolverClient.Delete(context.Context, string, string, string, string, string, *GraphQLAPIResolverClientDeleteOptions) (GraphQLAPIResolverClientDeleteResponse, error)` +- New function `*GraphQLAPIResolverClient.Get(context.Context, string, string, string, string, *GraphQLAPIResolverClientGetOptions) (GraphQLAPIResolverClientGetResponse, error)` +- New function `*GraphQLAPIResolverClient.GetEntityTag(context.Context, string, string, string, string, *GraphQLAPIResolverClientGetEntityTagOptions) (GraphQLAPIResolverClientGetEntityTagResponse, error)` +- New function `*GraphQLAPIResolverClient.NewListByAPIPager(string, string, string, *GraphQLAPIResolverClientListByAPIOptions) *runtime.Pager[GraphQLAPIResolverClientListByAPIResponse]` +- New function `*GraphQLAPIResolverClient.Update(context.Context, string, string, string, string, string, ResolverUpdateContract, *GraphQLAPIResolverClientUpdateOptions) (GraphQLAPIResolverClientUpdateResponse, error)` +- New function `NewGraphQLAPIResolverPolicyClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GraphQLAPIResolverPolicyClient, error)` +- New function `*GraphQLAPIResolverPolicyClient.CreateOrUpdate(context.Context, string, string, string, string, PolicyIDName, PolicyContract, *GraphQLAPIResolverPolicyClientCreateOrUpdateOptions) (GraphQLAPIResolverPolicyClientCreateOrUpdateResponse, error)` +- New function `*GraphQLAPIResolverPolicyClient.Delete(context.Context, string, string, string, string, PolicyIDName, string, *GraphQLAPIResolverPolicyClientDeleteOptions) (GraphQLAPIResolverPolicyClientDeleteResponse, error)` +- New function `*GraphQLAPIResolverPolicyClient.Get(context.Context, string, string, string, string, PolicyIDName, *GraphQLAPIResolverPolicyClientGetOptions) (GraphQLAPIResolverPolicyClientGetResponse, error)` +- New function `*GraphQLAPIResolverPolicyClient.GetEntityTag(context.Context, string, string, string, string, PolicyIDName, *GraphQLAPIResolverPolicyClientGetEntityTagOptions) (GraphQLAPIResolverPolicyClientGetEntityTagResponse, error)` +- New function `*GraphQLAPIResolverPolicyClient.NewListByResolverPager(string, string, string, string, *GraphQLAPIResolverPolicyClientListByResolverOptions) *runtime.Pager[GraphQLAPIResolverPolicyClientListByResolverResponse]` +- New function `NewPolicyFragmentClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PolicyFragmentClient, error)` +- New function `*PolicyFragmentClient.BeginCreateOrUpdate(context.Context, string, string, string, PolicyFragmentContract, *PolicyFragmentClientBeginCreateOrUpdateOptions) (*runtime.Poller[PolicyFragmentClientCreateOrUpdateResponse], error)` +- New function `*PolicyFragmentClient.Delete(context.Context, string, string, string, string, *PolicyFragmentClientDeleteOptions) (PolicyFragmentClientDeleteResponse, error)` +- New function `*PolicyFragmentClient.Get(context.Context, string, string, string, *PolicyFragmentClientGetOptions) (PolicyFragmentClientGetResponse, error)` +- New function `*PolicyFragmentClient.GetEntityTag(context.Context, string, string, string, *PolicyFragmentClientGetEntityTagOptions) (PolicyFragmentClientGetEntityTagResponse, error)` +- New function `*PolicyFragmentClient.NewListByServicePager(string, string, *PolicyFragmentClientListByServiceOptions) *runtime.Pager[PolicyFragmentClientListByServiceResponse]` +- New function `*PolicyFragmentClient.ListReferences(context.Context, string, string, string, *PolicyFragmentClientListReferencesOptions) (PolicyFragmentClientListReferencesResponse, error)` +- New function `NewPortalConfigClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PortalConfigClient, error)` +- New function `*PortalConfigClient.CreateOrUpdate(context.Context, string, string, string, string, PortalConfigContract, *PortalConfigClientCreateOrUpdateOptions) (PortalConfigClientCreateOrUpdateResponse, error)` +- New function `*PortalConfigClient.Get(context.Context, string, string, string, *PortalConfigClientGetOptions) (PortalConfigClientGetResponse, error)` +- New function `*PortalConfigClient.GetEntityTag(context.Context, string, string, string, *PortalConfigClientGetEntityTagOptions) (PortalConfigClientGetEntityTagResponse, error)` +- New function `*PortalConfigClient.NewListByServicePager(string, string, *PortalConfigClientListByServiceOptions) *runtime.Pager[PortalConfigClientListByServiceResponse]` +- New function `*PortalConfigClient.Update(context.Context, string, string, string, string, PortalConfigContract, *PortalConfigClientUpdateOptions) (PortalConfigClientUpdateResponse, error)` +- New function `NewProductAPILinkClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProductAPILinkClient, error)` +- New function `*ProductAPILinkClient.CreateOrUpdate(context.Context, string, string, string, string, ProductAPILinkContract, *ProductAPILinkClientCreateOrUpdateOptions) (ProductAPILinkClientCreateOrUpdateResponse, error)` +- New function `*ProductAPILinkClient.Delete(context.Context, string, string, string, string, *ProductAPILinkClientDeleteOptions) (ProductAPILinkClientDeleteResponse, error)` +- New function `*ProductAPILinkClient.Get(context.Context, string, string, string, string, *ProductAPILinkClientGetOptions) (ProductAPILinkClientGetResponse, error)` +- New function `*ProductAPILinkClient.NewListByProductPager(string, string, string, *ProductAPILinkClientListByProductOptions) *runtime.Pager[ProductAPILinkClientListByProductResponse]` +- New function `NewProductGroupLinkClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProductGroupLinkClient, error)` +- New function `*ProductGroupLinkClient.CreateOrUpdate(context.Context, string, string, string, string, ProductGroupLinkContract, *ProductGroupLinkClientCreateOrUpdateOptions) (ProductGroupLinkClientCreateOrUpdateResponse, error)` +- New function `*ProductGroupLinkClient.Delete(context.Context, string, string, string, string, *ProductGroupLinkClientDeleteOptions) (ProductGroupLinkClientDeleteResponse, error)` +- New function `*ProductGroupLinkClient.Get(context.Context, string, string, string, string, *ProductGroupLinkClientGetOptions) (ProductGroupLinkClientGetResponse, error)` +- New function `*ProductGroupLinkClient.NewListByProductPager(string, string, string, *ProductGroupLinkClientListByProductOptions) *runtime.Pager[ProductGroupLinkClientListByProductResponse]` +- New function `NewProductWikiClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProductWikiClient, error)` +- New function `*ProductWikiClient.CreateOrUpdate(context.Context, string, string, string, WikiContract, *ProductWikiClientCreateOrUpdateOptions) (ProductWikiClientCreateOrUpdateResponse, error)` +- New function `*ProductWikiClient.Delete(context.Context, string, string, string, string, *ProductWikiClientDeleteOptions) (ProductWikiClientDeleteResponse, error)` +- New function `*ProductWikiClient.Get(context.Context, string, string, string, *ProductWikiClientGetOptions) (ProductWikiClientGetResponse, error)` +- New function `*ProductWikiClient.GetEntityTag(context.Context, string, string, string, *ProductWikiClientGetEntityTagOptions) (ProductWikiClientGetEntityTagResponse, error)` +- New function `*ProductWikiClient.Update(context.Context, string, string, string, string, WikiUpdateContract, *ProductWikiClientUpdateOptions) (ProductWikiClientUpdateResponse, error)` +- New function `NewProductWikisClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProductWikisClient, error)` +- New function `*ProductWikisClient.NewListPager(string, string, string, *ProductWikisClientListOptions) *runtime.Pager[ProductWikisClientListResponse]` +- New function `*ServiceClient.BeginMigrateToStv2(context.Context, string, string, *ServiceClientBeginMigrateToStv2Options) (*runtime.Poller[ServiceClientMigrateToStv2Response], error)` +- New function `NewTagAPILinkClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TagAPILinkClient, error)` +- New function `*TagAPILinkClient.CreateOrUpdate(context.Context, string, string, string, string, TagAPILinkContract, *TagAPILinkClientCreateOrUpdateOptions) (TagAPILinkClientCreateOrUpdateResponse, error)` +- New function `*TagAPILinkClient.Delete(context.Context, string, string, string, string, *TagAPILinkClientDeleteOptions) (TagAPILinkClientDeleteResponse, error)` +- New function `*TagAPILinkClient.Get(context.Context, string, string, string, string, *TagAPILinkClientGetOptions) (TagAPILinkClientGetResponse, error)` +- New function `*TagAPILinkClient.NewListByProductPager(string, string, string, *TagAPILinkClientListByProductOptions) *runtime.Pager[TagAPILinkClientListByProductResponse]` +- New function `NewTagOperationLinkClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TagOperationLinkClient, error)` +- New function `*TagOperationLinkClient.CreateOrUpdate(context.Context, string, string, string, string, TagOperationLinkContract, *TagOperationLinkClientCreateOrUpdateOptions) (TagOperationLinkClientCreateOrUpdateResponse, error)` +- New function `*TagOperationLinkClient.Delete(context.Context, string, string, string, string, *TagOperationLinkClientDeleteOptions) (TagOperationLinkClientDeleteResponse, error)` +- New function `*TagOperationLinkClient.Get(context.Context, string, string, string, string, *TagOperationLinkClientGetOptions) (TagOperationLinkClientGetResponse, error)` +- New function `*TagOperationLinkClient.NewListByProductPager(string, string, string, *TagOperationLinkClientListByProductOptions) *runtime.Pager[TagOperationLinkClientListByProductResponse]` +- New function `NewTagProductLinkClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TagProductLinkClient, error)` +- New function `*TagProductLinkClient.CreateOrUpdate(context.Context, string, string, string, string, TagProductLinkContract, *TagProductLinkClientCreateOrUpdateOptions) (TagProductLinkClientCreateOrUpdateResponse, error)` +- New function `*TagProductLinkClient.Delete(context.Context, string, string, string, string, *TagProductLinkClientDeleteOptions) (TagProductLinkClientDeleteResponse, error)` +- New function `*TagProductLinkClient.Get(context.Context, string, string, string, string, *TagProductLinkClientGetOptions) (TagProductLinkClientGetResponse, error)` +- New function `*TagProductLinkClient.NewListByProductPager(string, string, string, *TagProductLinkClientListByProductOptions) *runtime.Pager[TagProductLinkClientListByProductResponse]` +- New function `NewWorkspaceAPIClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceAPIClient, error)` +- New function `*WorkspaceAPIClient.BeginCreateOrUpdate(context.Context, string, string, string, string, APICreateOrUpdateParameter, *WorkspaceAPIClientBeginCreateOrUpdateOptions) (*runtime.Poller[WorkspaceAPIClientCreateOrUpdateResponse], error)` +- New function `*WorkspaceAPIClient.Delete(context.Context, string, string, string, string, string, *WorkspaceAPIClientDeleteOptions) (WorkspaceAPIClientDeleteResponse, error)` +- New function `*WorkspaceAPIClient.Get(context.Context, string, string, string, string, *WorkspaceAPIClientGetOptions) (WorkspaceAPIClientGetResponse, error)` +- New function `*WorkspaceAPIClient.GetEntityTag(context.Context, string, string, string, string, *WorkspaceAPIClientGetEntityTagOptions) (WorkspaceAPIClientGetEntityTagResponse, error)` +- New function `*WorkspaceAPIClient.NewListByServicePager(string, string, string, *WorkspaceAPIClientListByServiceOptions) *runtime.Pager[WorkspaceAPIClientListByServiceResponse]` +- New function `*WorkspaceAPIClient.Update(context.Context, string, string, string, string, string, APIUpdateContract, *WorkspaceAPIClientUpdateOptions) (WorkspaceAPIClientUpdateResponse, error)` +- New function `NewWorkspaceAPIExportClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceAPIExportClient, error)` +- New function `*WorkspaceAPIExportClient.Get(context.Context, string, string, string, string, ExportFormat, ExportAPI, *WorkspaceAPIExportClientGetOptions) (WorkspaceAPIExportClientGetResponse, error)` +- New function `NewWorkspaceAPIOperationClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceAPIOperationClient, error)` +- New function `*WorkspaceAPIOperationClient.CreateOrUpdate(context.Context, string, string, string, string, string, OperationContract, *WorkspaceAPIOperationClientCreateOrUpdateOptions) (WorkspaceAPIOperationClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceAPIOperationClient.Delete(context.Context, string, string, string, string, string, string, *WorkspaceAPIOperationClientDeleteOptions) (WorkspaceAPIOperationClientDeleteResponse, error)` +- New function `*WorkspaceAPIOperationClient.Get(context.Context, string, string, string, string, string, *WorkspaceAPIOperationClientGetOptions) (WorkspaceAPIOperationClientGetResponse, error)` +- New function `*WorkspaceAPIOperationClient.GetEntityTag(context.Context, string, string, string, string, string, *WorkspaceAPIOperationClientGetEntityTagOptions) (WorkspaceAPIOperationClientGetEntityTagResponse, error)` +- New function `*WorkspaceAPIOperationClient.NewListByAPIPager(string, string, string, string, *WorkspaceAPIOperationClientListByAPIOptions) *runtime.Pager[WorkspaceAPIOperationClientListByAPIResponse]` +- New function `*WorkspaceAPIOperationClient.Update(context.Context, string, string, string, string, string, string, OperationUpdateContract, *WorkspaceAPIOperationClientUpdateOptions) (WorkspaceAPIOperationClientUpdateResponse, error)` +- New function `NewWorkspaceAPIOperationPolicyClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceAPIOperationPolicyClient, error)` +- New function `*WorkspaceAPIOperationPolicyClient.CreateOrUpdate(context.Context, string, string, string, string, string, PolicyIDName, PolicyContract, *WorkspaceAPIOperationPolicyClientCreateOrUpdateOptions) (WorkspaceAPIOperationPolicyClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceAPIOperationPolicyClient.Delete(context.Context, string, string, string, string, string, PolicyIDName, string, *WorkspaceAPIOperationPolicyClientDeleteOptions) (WorkspaceAPIOperationPolicyClientDeleteResponse, error)` +- New function `*WorkspaceAPIOperationPolicyClient.Get(context.Context, string, string, string, string, string, PolicyIDName, *WorkspaceAPIOperationPolicyClientGetOptions) (WorkspaceAPIOperationPolicyClientGetResponse, error)` +- New function `*WorkspaceAPIOperationPolicyClient.GetEntityTag(context.Context, string, string, string, string, string, PolicyIDName, *WorkspaceAPIOperationPolicyClientGetEntityTagOptions) (WorkspaceAPIOperationPolicyClientGetEntityTagResponse, error)` +- New function `*WorkspaceAPIOperationPolicyClient.NewListByOperationPager(string, string, string, string, string, *WorkspaceAPIOperationPolicyClientListByOperationOptions) *runtime.Pager[WorkspaceAPIOperationPolicyClientListByOperationResponse]` +- New function `NewWorkspaceAPIPolicyClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceAPIPolicyClient, error)` +- New function `*WorkspaceAPIPolicyClient.CreateOrUpdate(context.Context, string, string, string, string, PolicyIDName, PolicyContract, *WorkspaceAPIPolicyClientCreateOrUpdateOptions) (WorkspaceAPIPolicyClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceAPIPolicyClient.Delete(context.Context, string, string, string, string, PolicyIDName, string, *WorkspaceAPIPolicyClientDeleteOptions) (WorkspaceAPIPolicyClientDeleteResponse, error)` +- New function `*WorkspaceAPIPolicyClient.Get(context.Context, string, string, string, string, PolicyIDName, *WorkspaceAPIPolicyClientGetOptions) (WorkspaceAPIPolicyClientGetResponse, error)` +- New function `*WorkspaceAPIPolicyClient.GetEntityTag(context.Context, string, string, string, string, PolicyIDName, *WorkspaceAPIPolicyClientGetEntityTagOptions) (WorkspaceAPIPolicyClientGetEntityTagResponse, error)` +- New function `*WorkspaceAPIPolicyClient.NewListByAPIPager(string, string, string, string, *WorkspaceAPIPolicyClientListByAPIOptions) *runtime.Pager[WorkspaceAPIPolicyClientListByAPIResponse]` +- New function `NewWorkspaceAPIReleaseClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceAPIReleaseClient, error)` +- New function `*WorkspaceAPIReleaseClient.CreateOrUpdate(context.Context, string, string, string, string, string, APIReleaseContract, *WorkspaceAPIReleaseClientCreateOrUpdateOptions) (WorkspaceAPIReleaseClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceAPIReleaseClient.Delete(context.Context, string, string, string, string, string, string, *WorkspaceAPIReleaseClientDeleteOptions) (WorkspaceAPIReleaseClientDeleteResponse, error)` +- New function `*WorkspaceAPIReleaseClient.Get(context.Context, string, string, string, string, string, *WorkspaceAPIReleaseClientGetOptions) (WorkspaceAPIReleaseClientGetResponse, error)` +- New function `*WorkspaceAPIReleaseClient.GetEntityTag(context.Context, string, string, string, string, string, *WorkspaceAPIReleaseClientGetEntityTagOptions) (WorkspaceAPIReleaseClientGetEntityTagResponse, error)` +- New function `*WorkspaceAPIReleaseClient.NewListByServicePager(string, string, string, string, *WorkspaceAPIReleaseClientListByServiceOptions) *runtime.Pager[WorkspaceAPIReleaseClientListByServiceResponse]` +- New function `*WorkspaceAPIReleaseClient.Update(context.Context, string, string, string, string, string, string, APIReleaseContract, *WorkspaceAPIReleaseClientUpdateOptions) (WorkspaceAPIReleaseClientUpdateResponse, error)` +- New function `NewWorkspaceAPIRevisionClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceAPIRevisionClient, error)` +- New function `*WorkspaceAPIRevisionClient.NewListByServicePager(string, string, string, string, *WorkspaceAPIRevisionClientListByServiceOptions) *runtime.Pager[WorkspaceAPIRevisionClientListByServiceResponse]` +- New function `NewWorkspaceAPISchemaClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceAPISchemaClient, error)` +- New function `*WorkspaceAPISchemaClient.BeginCreateOrUpdate(context.Context, string, string, string, string, string, SchemaContract, *WorkspaceAPISchemaClientBeginCreateOrUpdateOptions) (*runtime.Poller[WorkspaceAPISchemaClientCreateOrUpdateResponse], error)` +- New function `*WorkspaceAPISchemaClient.Delete(context.Context, string, string, string, string, string, string, *WorkspaceAPISchemaClientDeleteOptions) (WorkspaceAPISchemaClientDeleteResponse, error)` +- New function `*WorkspaceAPISchemaClient.Get(context.Context, string, string, string, string, string, *WorkspaceAPISchemaClientGetOptions) (WorkspaceAPISchemaClientGetResponse, error)` +- New function `*WorkspaceAPISchemaClient.GetEntityTag(context.Context, string, string, string, string, string, *WorkspaceAPISchemaClientGetEntityTagOptions) (WorkspaceAPISchemaClientGetEntityTagResponse, error)` +- New function `*WorkspaceAPISchemaClient.NewListByAPIPager(string, string, string, string, *WorkspaceAPISchemaClientListByAPIOptions) *runtime.Pager[WorkspaceAPISchemaClientListByAPIResponse]` +- New function `NewWorkspaceAPIVersionSetClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceAPIVersionSetClient, error)` +- New function `*WorkspaceAPIVersionSetClient.CreateOrUpdate(context.Context, string, string, string, string, APIVersionSetContract, *WorkspaceAPIVersionSetClientCreateOrUpdateOptions) (WorkspaceAPIVersionSetClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceAPIVersionSetClient.Delete(context.Context, string, string, string, string, string, *WorkspaceAPIVersionSetClientDeleteOptions) (WorkspaceAPIVersionSetClientDeleteResponse, error)` +- New function `*WorkspaceAPIVersionSetClient.Get(context.Context, string, string, string, string, *WorkspaceAPIVersionSetClientGetOptions) (WorkspaceAPIVersionSetClientGetResponse, error)` +- New function `*WorkspaceAPIVersionSetClient.GetEntityTag(context.Context, string, string, string, string, *WorkspaceAPIVersionSetClientGetEntityTagOptions) (WorkspaceAPIVersionSetClientGetEntityTagResponse, error)` +- New function `*WorkspaceAPIVersionSetClient.NewListByServicePager(string, string, string, *WorkspaceAPIVersionSetClientListByServiceOptions) *runtime.Pager[WorkspaceAPIVersionSetClientListByServiceResponse]` +- New function `*WorkspaceAPIVersionSetClient.Update(context.Context, string, string, string, string, string, APIVersionSetUpdateParameters, *WorkspaceAPIVersionSetClientUpdateOptions) (WorkspaceAPIVersionSetClientUpdateResponse, error)` +- New function `NewWorkspaceClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceClient, error)` +- New function `*WorkspaceClient.CreateOrUpdate(context.Context, string, string, string, WorkspaceContract, *WorkspaceClientCreateOrUpdateOptions) (WorkspaceClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceClient.Delete(context.Context, string, string, string, string, *WorkspaceClientDeleteOptions) (WorkspaceClientDeleteResponse, error)` +- New function `*WorkspaceClient.Get(context.Context, string, string, string, *WorkspaceClientGetOptions) (WorkspaceClientGetResponse, error)` +- New function `*WorkspaceClient.GetEntityTag(context.Context, string, string, string, *WorkspaceClientGetEntityTagOptions) (WorkspaceClientGetEntityTagResponse, error)` +- New function `*WorkspaceClient.NewListByServicePager(string, string, *WorkspaceClientListByServiceOptions) *runtime.Pager[WorkspaceClientListByServiceResponse]` +- New function `*WorkspaceClient.Update(context.Context, string, string, string, string, WorkspaceContract, *WorkspaceClientUpdateOptions) (WorkspaceClientUpdateResponse, error)` +- New function `NewWorkspaceGlobalSchemaClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceGlobalSchemaClient, error)` +- New function `*WorkspaceGlobalSchemaClient.BeginCreateOrUpdate(context.Context, string, string, string, string, GlobalSchemaContract, *WorkspaceGlobalSchemaClientBeginCreateOrUpdateOptions) (*runtime.Poller[WorkspaceGlobalSchemaClientCreateOrUpdateResponse], error)` +- New function `*WorkspaceGlobalSchemaClient.Delete(context.Context, string, string, string, string, string, *WorkspaceGlobalSchemaClientDeleteOptions) (WorkspaceGlobalSchemaClientDeleteResponse, error)` +- New function `*WorkspaceGlobalSchemaClient.Get(context.Context, string, string, string, string, *WorkspaceGlobalSchemaClientGetOptions) (WorkspaceGlobalSchemaClientGetResponse, error)` +- New function `*WorkspaceGlobalSchemaClient.GetEntityTag(context.Context, string, string, string, string, *WorkspaceGlobalSchemaClientGetEntityTagOptions) (WorkspaceGlobalSchemaClientGetEntityTagResponse, error)` +- New function `*WorkspaceGlobalSchemaClient.NewListByServicePager(string, string, string, *WorkspaceGlobalSchemaClientListByServiceOptions) *runtime.Pager[WorkspaceGlobalSchemaClientListByServiceResponse]` +- New function `NewWorkspaceGroupClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceGroupClient, error)` +- New function `*WorkspaceGroupClient.CreateOrUpdate(context.Context, string, string, string, string, GroupCreateParameters, *WorkspaceGroupClientCreateOrUpdateOptions) (WorkspaceGroupClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceGroupClient.Delete(context.Context, string, string, string, string, string, *WorkspaceGroupClientDeleteOptions) (WorkspaceGroupClientDeleteResponse, error)` +- New function `*WorkspaceGroupClient.Get(context.Context, string, string, string, string, *WorkspaceGroupClientGetOptions) (WorkspaceGroupClientGetResponse, error)` +- New function `*WorkspaceGroupClient.GetEntityTag(context.Context, string, string, string, string, *WorkspaceGroupClientGetEntityTagOptions) (WorkspaceGroupClientGetEntityTagResponse, error)` +- New function `*WorkspaceGroupClient.NewListByServicePager(string, string, string, *WorkspaceGroupClientListByServiceOptions) *runtime.Pager[WorkspaceGroupClientListByServiceResponse]` +- New function `*WorkspaceGroupClient.Update(context.Context, string, string, string, string, string, GroupUpdateParameters, *WorkspaceGroupClientUpdateOptions) (WorkspaceGroupClientUpdateResponse, error)` +- New function `NewWorkspaceGroupUserClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceGroupUserClient, error)` +- New function `*WorkspaceGroupUserClient.CheckEntityExists(context.Context, string, string, string, string, string, *WorkspaceGroupUserClientCheckEntityExistsOptions) (WorkspaceGroupUserClientCheckEntityExistsResponse, error)` +- New function `*WorkspaceGroupUserClient.Create(context.Context, string, string, string, string, string, *WorkspaceGroupUserClientCreateOptions) (WorkspaceGroupUserClientCreateResponse, error)` +- New function `*WorkspaceGroupUserClient.Delete(context.Context, string, string, string, string, string, *WorkspaceGroupUserClientDeleteOptions) (WorkspaceGroupUserClientDeleteResponse, error)` +- New function `*WorkspaceGroupUserClient.NewListPager(string, string, string, string, *WorkspaceGroupUserClientListOptions) *runtime.Pager[WorkspaceGroupUserClientListResponse]` +- New function `NewWorkspaceNamedValueClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceNamedValueClient, error)` +- New function `*WorkspaceNamedValueClient.BeginCreateOrUpdate(context.Context, string, string, string, string, NamedValueCreateContract, *WorkspaceNamedValueClientBeginCreateOrUpdateOptions) (*runtime.Poller[WorkspaceNamedValueClientCreateOrUpdateResponse], error)` +- New function `*WorkspaceNamedValueClient.Delete(context.Context, string, string, string, string, string, *WorkspaceNamedValueClientDeleteOptions) (WorkspaceNamedValueClientDeleteResponse, error)` +- New function `*WorkspaceNamedValueClient.Get(context.Context, string, string, string, string, *WorkspaceNamedValueClientGetOptions) (WorkspaceNamedValueClientGetResponse, error)` +- New function `*WorkspaceNamedValueClient.GetEntityTag(context.Context, string, string, string, string, *WorkspaceNamedValueClientGetEntityTagOptions) (WorkspaceNamedValueClientGetEntityTagResponse, error)` +- New function `*WorkspaceNamedValueClient.NewListByServicePager(string, string, string, *WorkspaceNamedValueClientListByServiceOptions) *runtime.Pager[WorkspaceNamedValueClientListByServiceResponse]` +- New function `*WorkspaceNamedValueClient.ListValue(context.Context, string, string, string, string, *WorkspaceNamedValueClientListValueOptions) (WorkspaceNamedValueClientListValueResponse, error)` +- New function `*WorkspaceNamedValueClient.BeginRefreshSecret(context.Context, string, string, string, string, *WorkspaceNamedValueClientBeginRefreshSecretOptions) (*runtime.Poller[WorkspaceNamedValueClientRefreshSecretResponse], error)` +- New function `*WorkspaceNamedValueClient.BeginUpdate(context.Context, string, string, string, string, string, NamedValueUpdateParameters, *WorkspaceNamedValueClientBeginUpdateOptions) (*runtime.Poller[WorkspaceNamedValueClientUpdateResponse], error)` +- New function `NewWorkspaceNotificationClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceNotificationClient, error)` +- New function `*WorkspaceNotificationClient.CreateOrUpdate(context.Context, string, string, string, NotificationName, *WorkspaceNotificationClientCreateOrUpdateOptions) (WorkspaceNotificationClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceNotificationClient.Get(context.Context, string, string, string, NotificationName, *WorkspaceNotificationClientGetOptions) (WorkspaceNotificationClientGetResponse, error)` +- New function `*WorkspaceNotificationClient.NewListByServicePager(string, string, string, *WorkspaceNotificationClientListByServiceOptions) *runtime.Pager[WorkspaceNotificationClientListByServiceResponse]` +- New function `NewWorkspaceNotificationRecipientEmailClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceNotificationRecipientEmailClient, error)` +- New function `*WorkspaceNotificationRecipientEmailClient.CheckEntityExists(context.Context, string, string, string, NotificationName, string, *WorkspaceNotificationRecipientEmailClientCheckEntityExistsOptions) (WorkspaceNotificationRecipientEmailClientCheckEntityExistsResponse, error)` +- New function `*WorkspaceNotificationRecipientEmailClient.CreateOrUpdate(context.Context, string, string, string, NotificationName, string, *WorkspaceNotificationRecipientEmailClientCreateOrUpdateOptions) (WorkspaceNotificationRecipientEmailClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceNotificationRecipientEmailClient.Delete(context.Context, string, string, string, NotificationName, string, *WorkspaceNotificationRecipientEmailClientDeleteOptions) (WorkspaceNotificationRecipientEmailClientDeleteResponse, error)` +- New function `*WorkspaceNotificationRecipientEmailClient.ListByNotification(context.Context, string, string, string, NotificationName, *WorkspaceNotificationRecipientEmailClientListByNotificationOptions) (WorkspaceNotificationRecipientEmailClientListByNotificationResponse, error)` +- New function `NewWorkspaceNotificationRecipientUserClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceNotificationRecipientUserClient, error)` +- New function `*WorkspaceNotificationRecipientUserClient.CheckEntityExists(context.Context, string, string, string, NotificationName, string, *WorkspaceNotificationRecipientUserClientCheckEntityExistsOptions) (WorkspaceNotificationRecipientUserClientCheckEntityExistsResponse, error)` +- New function `*WorkspaceNotificationRecipientUserClient.CreateOrUpdate(context.Context, string, string, string, NotificationName, string, *WorkspaceNotificationRecipientUserClientCreateOrUpdateOptions) (WorkspaceNotificationRecipientUserClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceNotificationRecipientUserClient.Delete(context.Context, string, string, string, NotificationName, string, *WorkspaceNotificationRecipientUserClientDeleteOptions) (WorkspaceNotificationRecipientUserClientDeleteResponse, error)` +- New function `*WorkspaceNotificationRecipientUserClient.ListByNotification(context.Context, string, string, string, NotificationName, *WorkspaceNotificationRecipientUserClientListByNotificationOptions) (WorkspaceNotificationRecipientUserClientListByNotificationResponse, error)` +- New function `NewWorkspacePolicyClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspacePolicyClient, error)` +- New function `*WorkspacePolicyClient.CreateOrUpdate(context.Context, string, string, string, PolicyIDName, PolicyContract, *WorkspacePolicyClientCreateOrUpdateOptions) (WorkspacePolicyClientCreateOrUpdateResponse, error)` +- New function `*WorkspacePolicyClient.Delete(context.Context, string, string, string, PolicyIDName, string, *WorkspacePolicyClientDeleteOptions) (WorkspacePolicyClientDeleteResponse, error)` +- New function `*WorkspacePolicyClient.Get(context.Context, string, string, string, PolicyIDName, *WorkspacePolicyClientGetOptions) (WorkspacePolicyClientGetResponse, error)` +- New function `*WorkspacePolicyClient.GetEntityTag(context.Context, string, string, string, PolicyIDName, *WorkspacePolicyClientGetEntityTagOptions) (WorkspacePolicyClientGetEntityTagResponse, error)` +- New function `*WorkspacePolicyClient.NewListByAPIPager(string, string, string, *WorkspacePolicyClientListByAPIOptions) *runtime.Pager[WorkspacePolicyClientListByAPIResponse]` +- New function `NewWorkspacePolicyFragmentClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspacePolicyFragmentClient, error)` +- New function `*WorkspacePolicyFragmentClient.BeginCreateOrUpdate(context.Context, string, string, string, string, PolicyFragmentContract, *WorkspacePolicyFragmentClientBeginCreateOrUpdateOptions) (*runtime.Poller[WorkspacePolicyFragmentClientCreateOrUpdateResponse], error)` +- New function `*WorkspacePolicyFragmentClient.Delete(context.Context, string, string, string, string, string, *WorkspacePolicyFragmentClientDeleteOptions) (WorkspacePolicyFragmentClientDeleteResponse, error)` +- New function `*WorkspacePolicyFragmentClient.Get(context.Context, string, string, string, string, *WorkspacePolicyFragmentClientGetOptions) (WorkspacePolicyFragmentClientGetResponse, error)` +- New function `*WorkspacePolicyFragmentClient.GetEntityTag(context.Context, string, string, string, string, *WorkspacePolicyFragmentClientGetEntityTagOptions) (WorkspacePolicyFragmentClientGetEntityTagResponse, error)` +- New function `*WorkspacePolicyFragmentClient.NewListByServicePager(string, string, string, *WorkspacePolicyFragmentClientListByServiceOptions) *runtime.Pager[WorkspacePolicyFragmentClientListByServiceResponse]` +- New function `*WorkspacePolicyFragmentClient.ListReferences(context.Context, string, string, string, string, *WorkspacePolicyFragmentClientListReferencesOptions) (WorkspacePolicyFragmentClientListReferencesResponse, error)` +- New function `NewWorkspaceProductAPILinkClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceProductAPILinkClient, error)` +- New function `*WorkspaceProductAPILinkClient.CreateOrUpdate(context.Context, string, string, string, string, string, ProductAPILinkContract, *WorkspaceProductAPILinkClientCreateOrUpdateOptions) (WorkspaceProductAPILinkClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceProductAPILinkClient.Delete(context.Context, string, string, string, string, string, *WorkspaceProductAPILinkClientDeleteOptions) (WorkspaceProductAPILinkClientDeleteResponse, error)` +- New function `*WorkspaceProductAPILinkClient.Get(context.Context, string, string, string, string, string, *WorkspaceProductAPILinkClientGetOptions) (WorkspaceProductAPILinkClientGetResponse, error)` +- New function `*WorkspaceProductAPILinkClient.NewListByProductPager(string, string, string, string, *WorkspaceProductAPILinkClientListByProductOptions) *runtime.Pager[WorkspaceProductAPILinkClientListByProductResponse]` +- New function `NewWorkspaceProductClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceProductClient, error)` +- New function `*WorkspaceProductClient.CreateOrUpdate(context.Context, string, string, string, string, ProductContract, *WorkspaceProductClientCreateOrUpdateOptions) (WorkspaceProductClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceProductClient.Delete(context.Context, string, string, string, string, string, *WorkspaceProductClientDeleteOptions) (WorkspaceProductClientDeleteResponse, error)` +- New function `*WorkspaceProductClient.Get(context.Context, string, string, string, string, *WorkspaceProductClientGetOptions) (WorkspaceProductClientGetResponse, error)` +- New function `*WorkspaceProductClient.GetEntityTag(context.Context, string, string, string, string, *WorkspaceProductClientGetEntityTagOptions) (WorkspaceProductClientGetEntityTagResponse, error)` +- New function `*WorkspaceProductClient.NewListByServicePager(string, string, string, *WorkspaceProductClientListByServiceOptions) *runtime.Pager[WorkspaceProductClientListByServiceResponse]` +- New function `*WorkspaceProductClient.Update(context.Context, string, string, string, string, string, ProductUpdateParameters, *WorkspaceProductClientUpdateOptions) (WorkspaceProductClientUpdateResponse, error)` +- New function `NewWorkspaceProductGroupLinkClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceProductGroupLinkClient, error)` +- New function `*WorkspaceProductGroupLinkClient.CreateOrUpdate(context.Context, string, string, string, string, string, ProductGroupLinkContract, *WorkspaceProductGroupLinkClientCreateOrUpdateOptions) (WorkspaceProductGroupLinkClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceProductGroupLinkClient.Delete(context.Context, string, string, string, string, string, *WorkspaceProductGroupLinkClientDeleteOptions) (WorkspaceProductGroupLinkClientDeleteResponse, error)` +- New function `*WorkspaceProductGroupLinkClient.Get(context.Context, string, string, string, string, string, *WorkspaceProductGroupLinkClientGetOptions) (WorkspaceProductGroupLinkClientGetResponse, error)` +- New function `*WorkspaceProductGroupLinkClient.NewListByProductPager(string, string, string, string, *WorkspaceProductGroupLinkClientListByProductOptions) *runtime.Pager[WorkspaceProductGroupLinkClientListByProductResponse]` +- New function `NewWorkspaceProductPolicyClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceProductPolicyClient, error)` +- New function `*WorkspaceProductPolicyClient.CreateOrUpdate(context.Context, string, string, string, string, PolicyIDName, PolicyContract, *WorkspaceProductPolicyClientCreateOrUpdateOptions) (WorkspaceProductPolicyClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceProductPolicyClient.Delete(context.Context, string, string, string, string, PolicyIDName, string, *WorkspaceProductPolicyClientDeleteOptions) (WorkspaceProductPolicyClientDeleteResponse, error)` +- New function `*WorkspaceProductPolicyClient.Get(context.Context, string, string, string, string, PolicyIDName, *WorkspaceProductPolicyClientGetOptions) (WorkspaceProductPolicyClientGetResponse, error)` +- New function `*WorkspaceProductPolicyClient.GetEntityTag(context.Context, string, string, string, string, PolicyIDName, *WorkspaceProductPolicyClientGetEntityTagOptions) (WorkspaceProductPolicyClientGetEntityTagResponse, error)` +- New function `*WorkspaceProductPolicyClient.ListByProduct(context.Context, string, string, string, string, *WorkspaceProductPolicyClientListByProductOptions) (WorkspaceProductPolicyClientListByProductResponse, error)` +- New function `NewWorkspaceSubscriptionClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceSubscriptionClient, error)` +- New function `*WorkspaceSubscriptionClient.CreateOrUpdate(context.Context, string, string, string, string, SubscriptionCreateParameters, *WorkspaceSubscriptionClientCreateOrUpdateOptions) (WorkspaceSubscriptionClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceSubscriptionClient.Delete(context.Context, string, string, string, string, string, *WorkspaceSubscriptionClientDeleteOptions) (WorkspaceSubscriptionClientDeleteResponse, error)` +- New function `*WorkspaceSubscriptionClient.Get(context.Context, string, string, string, string, *WorkspaceSubscriptionClientGetOptions) (WorkspaceSubscriptionClientGetResponse, error)` +- New function `*WorkspaceSubscriptionClient.GetEntityTag(context.Context, string, string, string, string, *WorkspaceSubscriptionClientGetEntityTagOptions) (WorkspaceSubscriptionClientGetEntityTagResponse, error)` +- New function `*WorkspaceSubscriptionClient.NewListPager(string, string, string, *WorkspaceSubscriptionClientListOptions) *runtime.Pager[WorkspaceSubscriptionClientListResponse]` +- New function `*WorkspaceSubscriptionClient.ListSecrets(context.Context, string, string, string, string, *WorkspaceSubscriptionClientListSecretsOptions) (WorkspaceSubscriptionClientListSecretsResponse, error)` +- New function `*WorkspaceSubscriptionClient.RegeneratePrimaryKey(context.Context, string, string, string, string, *WorkspaceSubscriptionClientRegeneratePrimaryKeyOptions) (WorkspaceSubscriptionClientRegeneratePrimaryKeyResponse, error)` +- New function `*WorkspaceSubscriptionClient.RegenerateSecondaryKey(context.Context, string, string, string, string, *WorkspaceSubscriptionClientRegenerateSecondaryKeyOptions) (WorkspaceSubscriptionClientRegenerateSecondaryKeyResponse, error)` +- New function `*WorkspaceSubscriptionClient.Update(context.Context, string, string, string, string, string, SubscriptionUpdateParameters, *WorkspaceSubscriptionClientUpdateOptions) (WorkspaceSubscriptionClientUpdateResponse, error)` +- New function `NewWorkspaceTagAPILinkClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceTagAPILinkClient, error)` +- New function `*WorkspaceTagAPILinkClient.CreateOrUpdate(context.Context, string, string, string, string, string, TagAPILinkContract, *WorkspaceTagAPILinkClientCreateOrUpdateOptions) (WorkspaceTagAPILinkClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceTagAPILinkClient.Delete(context.Context, string, string, string, string, string, *WorkspaceTagAPILinkClientDeleteOptions) (WorkspaceTagAPILinkClientDeleteResponse, error)` +- New function `*WorkspaceTagAPILinkClient.Get(context.Context, string, string, string, string, string, *WorkspaceTagAPILinkClientGetOptions) (WorkspaceTagAPILinkClientGetResponse, error)` +- New function `*WorkspaceTagAPILinkClient.NewListByProductPager(string, string, string, string, *WorkspaceTagAPILinkClientListByProductOptions) *runtime.Pager[WorkspaceTagAPILinkClientListByProductResponse]` +- New function `NewWorkspaceTagClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceTagClient, error)` +- New function `*WorkspaceTagClient.CreateOrUpdate(context.Context, string, string, string, string, TagCreateUpdateParameters, *WorkspaceTagClientCreateOrUpdateOptions) (WorkspaceTagClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceTagClient.Delete(context.Context, string, string, string, string, string, *WorkspaceTagClientDeleteOptions) (WorkspaceTagClientDeleteResponse, error)` +- New function `*WorkspaceTagClient.Get(context.Context, string, string, string, string, *WorkspaceTagClientGetOptions) (WorkspaceTagClientGetResponse, error)` +- New function `*WorkspaceTagClient.GetEntityState(context.Context, string, string, string, string, *WorkspaceTagClientGetEntityStateOptions) (WorkspaceTagClientGetEntityStateResponse, error)` +- New function `*WorkspaceTagClient.NewListByServicePager(string, string, string, *WorkspaceTagClientListByServiceOptions) *runtime.Pager[WorkspaceTagClientListByServiceResponse]` +- New function `*WorkspaceTagClient.Update(context.Context, string, string, string, string, string, TagCreateUpdateParameters, *WorkspaceTagClientUpdateOptions) (WorkspaceTagClientUpdateResponse, error)` +- New function `NewWorkspaceTagOperationLinkClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceTagOperationLinkClient, error)` +- New function `*WorkspaceTagOperationLinkClient.CreateOrUpdate(context.Context, string, string, string, string, string, TagOperationLinkContract, *WorkspaceTagOperationLinkClientCreateOrUpdateOptions) (WorkspaceTagOperationLinkClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceTagOperationLinkClient.Delete(context.Context, string, string, string, string, string, *WorkspaceTagOperationLinkClientDeleteOptions) (WorkspaceTagOperationLinkClientDeleteResponse, error)` +- New function `*WorkspaceTagOperationLinkClient.Get(context.Context, string, string, string, string, string, *WorkspaceTagOperationLinkClientGetOptions) (WorkspaceTagOperationLinkClientGetResponse, error)` +- New function `*WorkspaceTagOperationLinkClient.NewListByProductPager(string, string, string, string, *WorkspaceTagOperationLinkClientListByProductOptions) *runtime.Pager[WorkspaceTagOperationLinkClientListByProductResponse]` +- New function `NewWorkspaceTagProductLinkClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WorkspaceTagProductLinkClient, error)` +- New function `*WorkspaceTagProductLinkClient.CreateOrUpdate(context.Context, string, string, string, string, string, TagProductLinkContract, *WorkspaceTagProductLinkClientCreateOrUpdateOptions) (WorkspaceTagProductLinkClientCreateOrUpdateResponse, error)` +- New function `*WorkspaceTagProductLinkClient.Delete(context.Context, string, string, string, string, string, *WorkspaceTagProductLinkClientDeleteOptions) (WorkspaceTagProductLinkClientDeleteResponse, error)` +- New function `*WorkspaceTagProductLinkClient.Get(context.Context, string, string, string, string, string, *WorkspaceTagProductLinkClientGetOptions) (WorkspaceTagProductLinkClientGetResponse, error)` +- New function `*WorkspaceTagProductLinkClient.NewListByProductPager(string, string, string, string, *WorkspaceTagProductLinkClientListByProductOptions) *runtime.Pager[WorkspaceTagProductLinkClientListByProductResponse]` +- New struct `AuthorizationAccessPolicyCollection` +- New struct `AuthorizationAccessPolicyContract` +- New struct `AuthorizationAccessPolicyContractProperties` +- New struct `AuthorizationCollection` +- New struct `AuthorizationConfirmConsentCodeRequestContract` +- New struct `AuthorizationContract` +- New struct `AuthorizationContractProperties` +- New struct `AuthorizationError` +- New struct `AuthorizationLoginRequestContract` +- New struct `AuthorizationLoginResponseContract` +- New struct `AuthorizationProviderCollection` +- New struct `AuthorizationProviderContract` +- New struct `AuthorizationProviderContractProperties` +- New struct `AuthorizationProviderOAuth2GrantTypes` +- New struct `AuthorizationProviderOAuth2Settings` +- New struct `BackendCircuitBreaker` +- New struct `CircuitBreakerFailureCondition` +- New struct `CircuitBreakerRule` +- New struct `ConfigurationAPI` +- New struct `DocumentationCollection` +- New struct `DocumentationContract` +- New struct `DocumentationContractProperties` +- New struct `DocumentationUpdateContract` +- New struct `FailureStatusCodeRange` +- New struct `GatewayDebugCredentialsContract` +- New struct `GatewayListDebugCredentialsContract` +- New struct `GatewayListTraceContract` +- New struct `MigrateToStv2Contract` +- New struct `PolicyFragmentCollection` +- New struct `PolicyFragmentContract` +- New struct `PolicyFragmentContractProperties` +- New struct `PortalConfigCollection` +- New struct `PortalConfigContract` +- New struct `PortalConfigCorsProperties` +- New struct `PortalConfigCspProperties` +- New struct `PortalConfigDelegationProperties` +- New struct `PortalConfigProperties` +- New struct `PortalConfigPropertiesSignin` +- New struct `PortalConfigPropertiesSignup` +- New struct `PortalConfigTermsOfServiceProperties` +- New struct `ProductAPILinkCollection` +- New struct `ProductAPILinkContract` +- New struct `ProductAPILinkContractProperties` +- New struct `ProductGroupLinkCollection` +- New struct `ProductGroupLinkContract` +- New struct `ProductGroupLinkContractProperties` +- New struct `ProxyResource` +- New struct `ResolverCollection` +- New struct `ResolverContract` +- New struct `ResolverEntityBaseContract` +- New struct `ResolverResultContract` +- New struct `ResolverResultContractProperties` +- New struct `ResolverResultLogItemContract` +- New struct `ResolverUpdateContract` +- New struct `ResolverUpdateContractProperties` +- New struct `ResourceCollection` +- New struct `ResourceCollectionValueItem` +- New struct `TagAPILinkCollection` +- New struct `TagAPILinkContract` +- New struct `TagAPILinkContractProperties` +- New struct `TagOperationLinkCollection` +- New struct `TagOperationLinkContract` +- New struct `TagOperationLinkContractProperties` +- New struct `TagProductLinkCollection` +- New struct `TagProductLinkContract` +- New struct `TagProductLinkContractProperties` +- New struct `WikiCollection` +- New struct `WikiContract` +- New struct `WikiContractProperties` +- New struct `WikiDocumentationContract` +- New struct `WikiUpdateContract` +- New struct `WorkspaceCollection` +- New struct `WorkspaceContract` +- New struct `WorkspaceContractProperties` +- New field `TranslateRequiredQueryParametersConduct` in struct `APICreateOrUpdateProperties` +- New field `NatGatewayState`, `OutboundPublicIPAddresses` in struct `AdditionalLocation` +- New field `OAuth2AuthenticationSettings`, `OpenidAuthenticationSettings` in struct `AuthenticationSettingsContract` +- New field `UseInAPIDocumentation`, `UseInTestConsole` in struct `AuthorizationServerContractProperties` +- New field `UseInAPIDocumentation`, `UseInTestConsole` in struct `AuthorizationServerUpdateContractProperties` +- New field `CircuitBreaker` in struct `BackendBaseParameters` +- New field `CircuitBreaker` in struct `BackendContractProperties` +- New field `CircuitBreaker` in struct `BackendUpdateParameterProperties` +- New field `Metrics` in struct `DiagnosticContractProperties` +- New field `ClientLibrary` in struct `IdentityProviderBaseParameters` +- New field `ClientLibrary` in struct `IdentityProviderContractProperties` +- New field `ClientLibrary` in struct `IdentityProviderCreateContractProperties` +- New field `ClientLibrary` in struct `IdentityProviderUpdateProperties` +- New field `UseInAPIDocumentation`, `UseInTestConsole` in struct `OpenidConnectProviderContractProperties` +- New field `UseInAPIDocumentation`, `UseInTestConsole` in struct `OpenidConnectProviderUpdateContractProperties` +- New field `ConfigurationAPI`, `DeveloperPortalEnabled`, `LegacyPortalEnabled`, `NatGatewayState`, `OutboundPublicIPAddresses` in struct `ServiceBaseProperties` +- New field `ConfigurationAPI`, `DeveloperPortalEnabled`, `LegacyPortalEnabled`, `NatGatewayState`, `OutboundPublicIPAddresses` in struct `ServiceProperties` +- New field `ConfigurationAPI`, `DeveloperPortalEnabled`, `LegacyPortalEnabled`, `NatGatewayState`, `OutboundPublicIPAddresses` in struct `ServiceUpdateProperties` + + ## 1.1.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/api_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/api_client.go index e085c2781709..9ce3600d9585 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/api_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/api_client.go @@ -30,8 +30,7 @@ type APIClient struct { } // NewAPIClient creates a new instance of APIClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIClient, error) { @@ -49,8 +48,8 @@ func NewAPIClient(subscriptionID string, credential azcore.TokenCredential, opti // BeginCreateOrUpdate - Creates new or updates existing specified API of the API Management service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -73,7 +72,7 @@ func (client *APIClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupN // CreateOrUpdate - Creates new or updates existing specified API of the API Management service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *APIClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiID string, parameters APICreateOrUpdateParameter, options *APIClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, apiID, parameters, options) if err != nil { @@ -113,7 +112,7 @@ func (client *APIClient) createOrUpdateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -125,8 +124,8 @@ func (client *APIClient) createOrUpdateCreateRequest(ctx context.Context, resour // Delete - Deletes the specified API of the API Management service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -175,7 +174,7 @@ func (client *APIClient) deleteCreateRequest(ctx context.Context, resourceGroupN if options != nil && options.DeleteRevisions != nil { reqQP.Set("deleteRevisions", strconv.FormatBool(*options.DeleteRevisions)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -185,8 +184,8 @@ func (client *APIClient) deleteCreateRequest(ctx context.Context, resourceGroupN // Get - Gets the details of the API specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -230,7 +229,7 @@ func (client *APIClient) getCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,8 +249,8 @@ func (client *APIClient) getHandleResponse(resp *http.Response) (APIClientGetRes // GetEntityTag - Gets the entity state (Etag) version of the API specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -295,7 +294,7 @@ func (client *APIClient) getEntityTagCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -313,8 +312,8 @@ func (client *APIClient) getEntityTagHandleResponse(resp *http.Response) (APICli // NewListByServicePager - Lists all APIs of the API Management service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - APIClientListByServiceOptions contains the optional parameters for the APIClient.NewListByServicePager method. func (client *APIClient) NewListByServicePager(resourceGroupName string, serviceName string, options *APIClientListByServiceOptions) *runtime.Pager[APIClientListByServiceResponse] { @@ -380,7 +379,7 @@ func (client *APIClient) listByServiceCreateRequest(ctx context.Context, resourc if options != nil && options.ExpandAPIVersionSet != nil { reqQP.Set("expandApiVersionSet", strconv.FormatBool(*options.ExpandAPIVersionSet)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -397,8 +396,8 @@ func (client *APIClient) listByServiceHandleResponse(resp *http.Response) (APICl // NewListByTagsPager - Lists a collection of apis associated with tags. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - APIClientListByTagsOptions contains the optional parameters for the APIClient.NewListByTagsPager method. func (client *APIClient) NewListByTagsPager(resourceGroupName string, serviceName string, options *APIClientListByTagsOptions) *runtime.Pager[APIClientListByTagsResponse] { @@ -461,7 +460,7 @@ func (client *APIClient) listByTagsCreateRequest(ctx context.Context, resourceGr if options != nil && options.IncludeNotTaggedApis != nil { reqQP.Set("includeNotTaggedApis", strconv.FormatBool(*options.IncludeNotTaggedApis)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -479,8 +478,8 @@ func (client *APIClient) listByTagsHandleResponse(resp *http.Response) (APIClien // Update - Updates the specified API of the API Management service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -527,7 +526,7 @@ func (client *APIClient) updateCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/api_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/api_client_example_test.go deleted file mode 100644 index 43bc9d98dd64..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/api_client_example_test.go +++ /dev/null @@ -1,1041 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApis.json -func ExampleAPIClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.APIClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: nil, - Tags: nil, - ExpandAPIVersionSet: 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.APICollection = armapimanagement.APICollection{ - // Count: to.Ptr[int64](4), - // Value: []*armapimanagement.APIContract{ - // { - // Name: to.Ptr("a1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1"), - // Properties: &armapimanagement.APIContractProperties{ - // APIRevision: to.Ptr("1"), - // APIVersionSetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/c48f96c9-1385-4e2d-b410-5ab591ce0fc4"), - // IsCurrent: to.Ptr(true), - // Path: to.Ptr("api1"), - // DisplayName: to.Ptr("api1"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api"), - // }, - // }, - // { - // Name: to.Ptr("5a73933b8f27f7cc82a2d533"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/5a73933b8f27f7cc82a2d533"), - // Properties: &armapimanagement.APIContractProperties{ - // APIRevision: to.Ptr("1"), - // APIVersion: to.Ptr("v1"), - // APIVersionSetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/c48f96c9-1385-4e2d-b410-5ab591ce0fc4"), - // IsCurrent: to.Ptr(true), - // Path: to.Ptr("api1"), - // DisplayName: to.Ptr("api1"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api"), - // }, - // }, - // { - // Name: to.Ptr("echo-api"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"), - // Properties: &armapimanagement.APIContractProperties{ - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // Path: to.Ptr("echo"), - // DisplayName: to.Ptr("Echo API"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api"), - // }, - // }, - // { - // Name: to.Ptr("5a7390baa5816a110435aee0"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/5a7390baa5816a110435aee0"), - // Properties: &armapimanagement.APIContractProperties{ - // Description: to.Ptr("A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification"), - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // Path: to.Ptr("vvv"), - // DisplayName: to.Ptr("Swagger Petstore Extensive"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://petstore.swagger.wordnik.com/api"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApi.json -func ExampleAPIClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIClient().GetEntityTag(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiContract.json -func ExampleAPIClient_Get_apiManagementGetApiContract() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIClient().Get(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("57d1f7558aa04f15146d9d8a"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a"), - // Properties: &armapimanagement.APIContractProperties{ - // APIType: to.Ptr(armapimanagement.APITypeSoap), - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // IsOnline: to.Ptr(true), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // Path: to.Ptr("schulte"), - // DisplayName: to.Ptr("Service"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("https://api.plexonline.com/DataSource/Service.asmx"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRevision.json -func ExampleAPIClient_Get_apiManagementGetApiRevisionContract() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIClient().Get(ctx, "rg1", "apimService1", "echo-api;rev=3", 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("echo-api;rev=3"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api;rev=3"), - // Properties: &armapimanagement.APIContractProperties{ - // APIRevision: to.Ptr("3"), - // APIRevisionDescription: to.Ptr("fixed bug in contract"), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // Path: to.Ptr("schulte"), - // DisplayName: to.Ptr("Service"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("https://api.plexonline.com/DataSource/Service.asmx"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApi.json -func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApi() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "tempgroup", armapimanagement.APICreateOrUpdateParameter{ - Properties: &armapimanagement.APICreateOrUpdateProperties{ - Description: to.Ptr("apidescription5200"), - AuthenticationSettings: &armapimanagement.AuthenticationSettingsContract{ - OAuth2: &armapimanagement.OAuth2AuthenticationSettingsContract{ - AuthorizationServerID: to.Ptr("authorizationServerId2283"), - Scope: to.Ptr("oauth2scope2580"), - }, - }, - SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - Header: to.Ptr("header4520"), - Query: to.Ptr("query3037"), - }, - Path: to.Ptr("newapiPath"), - DisplayName: to.Ptr("apiname1463"), - Protocols: []*armapimanagement.Protocol{ - to.Ptr(armapimanagement.ProtocolHTTPS), - to.Ptr(armapimanagement.ProtocolHTTP)}, - ServiceURL: to.Ptr("http://newechoapi.cloudapp.net/api"), - }, - }, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("apiid9419"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419"), - // Properties: &armapimanagement.APIContractProperties{ - // Description: to.Ptr("apidescription5200"), - // APIRevision: to.Ptr("1"), - // AuthenticationSettings: &armapimanagement.AuthenticationSettingsContract{ - // OAuth2: &armapimanagement.OAuth2AuthenticationSettingsContract{ - // AuthorizationServerID: to.Ptr("authorizationServerId2283"), - // Scope: to.Ptr("oauth2scope2580"), - // }, - // }, - // IsCurrent: to.Ptr(true), - // IsOnline: to.Ptr(true), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("header4520"), - // Query: to.Ptr("query3037"), - // }, - // Path: to.Ptr("newapiPath"), - // DisplayName: to.Ptr("apiname1463"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTP), - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://newechoapi.cloudapp.net/api"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiClone.json -func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiClone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "echo-api2", armapimanagement.APICreateOrUpdateParameter{ - Properties: &armapimanagement.APICreateOrUpdateProperties{ - Description: to.Ptr("Copy of Existing Echo Api including Operations."), - IsCurrent: to.Ptr(true), - SubscriptionRequired: to.Ptr(true), - Path: to.Ptr("echo2"), - DisplayName: to.Ptr("Echo API2"), - Protocols: []*armapimanagement.Protocol{ - to.Ptr(armapimanagement.ProtocolHTTP), - to.Ptr(armapimanagement.ProtocolHTTPS)}, - ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api"), - SourceAPIID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58a4aeac497000007d040001"), - }, - }, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("echoapi2"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoapi2"), - // Properties: &armapimanagement.APIContractProperties{ - // Description: to.Ptr("Copy of Existing Echo Api including Operations."), - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // SubscriptionRequired: to.Ptr(true), - // Path: to.Ptr("echo2"), - // DisplayName: to.Ptr("Echo API2"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTP), - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiNewVersionUsingExistingApi.json -func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiNewVersionUsingExistingApi() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "echoapiv3", armapimanagement.APICreateOrUpdateParameter{ - Properties: &armapimanagement.APICreateOrUpdateProperties{ - Description: to.Ptr("Create Echo API into a new Version using Existing Version Set and Copy all Operations."), - APIVersion: to.Ptr("v4"), - APIVersionSetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458"), - IsCurrent: to.Ptr(true), - SubscriptionRequired: to.Ptr(true), - Path: to.Ptr("echo2"), - DisplayName: to.Ptr("Echo API2"), - Protocols: []*armapimanagement.Protocol{ - to.Ptr(armapimanagement.ProtocolHTTP), - to.Ptr(armapimanagement.ProtocolHTTPS)}, - ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api"), - SourceAPIID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoPath"), - }, - }, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("echoapiv3"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoapiv3"), - // Properties: &armapimanagement.APIContractProperties{ - // Description: to.Ptr("Create Echo API into a new Version using Existing Version Set and Copy all Operations."), - // APIRevision: to.Ptr("1"), - // APIVersion: to.Ptr("v4"), - // APIVersionSetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458"), - // IsCurrent: to.Ptr(true), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // SubscriptionRequired: to.Ptr(true), - // Path: to.Ptr("echo2"), - // APIVersionSet: &armapimanagement.APIVersionSetContractDetails{ - // Name: to.Ptr("Echo API2"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458"), - // VersioningScheme: to.Ptr(armapimanagement.APIVersionSetContractDetailsVersioningSchemeSegment), - // }, - // DisplayName: to.Ptr("Echo API2"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTP), - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiRevisionFromExistingApi.json -func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiRevisionFromExistingApi() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "echo-api;rev=3", armapimanagement.APICreateOrUpdateParameter{ - Properties: &armapimanagement.APICreateOrUpdateProperties{ - APIRevisionDescription: to.Ptr("Creating a Revision of an existing API"), - Path: to.Ptr("echo"), - ServiceURL: to.Ptr("http://echoapi.cloudapp.net/apiv3"), - SourceAPIID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"), - }, - }, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("echo-api;rev=3"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api;rev=3"), - // Properties: &armapimanagement.APIContractProperties{ - // APIRevision: to.Ptr("3"), - // APIRevisionDescription: to.Ptr("Creating a Revision of an existing API"), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // SubscriptionRequired: to.Ptr(true), - // Path: to.Ptr("echo"), - // DisplayName: to.Ptr("Echo API"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://echoapi.cloudapp.net/apiv3"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiUsingImportOverrideServiceUrl.json -func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiUsingImportOverrideServiceUrl() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "apidocs", armapimanagement.APICreateOrUpdateParameter{ - Properties: &armapimanagement.APICreateOrUpdateProperties{ - Path: to.Ptr("petstoreapi123"), - ServiceURL: to.Ptr("http://petstore.swagger.wordnik.com/api"), - Format: to.Ptr(armapimanagement.ContentFormat("swagger-link")), - Value: to.Ptr("http://apimpimportviaurl.azurewebsites.net/api/apidocs/"), - }, - }, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("apidocs"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apidocs"), - // Properties: &armapimanagement.APIContractProperties{ - // Description: to.Ptr("This is a sample server Petstore server. You can find out more about Swagger \n at http://swagger.wordnik.com or on irc.freenode.net, #swagger. For this sample,\n you can use the api key \"special-key\" to test the authorization filters"), - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // Path: to.Ptr("petstoreapi123"), - // DisplayName: to.Ptr("Swagger Sample App"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://petstore.swagger.wordnik.com/api"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiUsingOai3Import.json -func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiUsingOai3Import() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "petstore", armapimanagement.APICreateOrUpdateParameter{ - Properties: &armapimanagement.APICreateOrUpdateProperties{ - Path: to.Ptr("petstore"), - Format: to.Ptr(armapimanagement.ContentFormatOpenapiLink), - Value: to.Ptr("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml"), - }, - }, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("petstoreapi"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstoreapi"), - // Properties: &armapimanagement.APIContractProperties{ - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // Path: to.Ptr("petstore"), - // DisplayName: to.Ptr("Swagger Petstore"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://petstore.swagger.io/v1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiUsingSwaggerImport.json -func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiUsingSwaggerImport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "petstore", armapimanagement.APICreateOrUpdateParameter{ - Properties: &armapimanagement.APICreateOrUpdateProperties{ - Path: to.Ptr("petstore"), - Format: to.Ptr(armapimanagement.ContentFormatSwaggerLinkJSON), - Value: to.Ptr("http://petstore.swagger.io/v2/swagger.json"), - }, - }, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("petstoreapi"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstoreapi"), - // Properties: &armapimanagement.APIContractProperties{ - // Description: to.Ptr("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."), - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // Path: to.Ptr("petstore"), - // DisplayName: to.Ptr("Swagger Petstore"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTP)}, - // ServiceURL: to.Ptr("http://petstore.swagger.io/v2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiUsingWadlImport.json -func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiUsingWadlImport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "petstore", armapimanagement.APICreateOrUpdateParameter{ - Properties: &armapimanagement.APICreateOrUpdateProperties{ - Path: to.Ptr("collector"), - Format: to.Ptr(armapimanagement.ContentFormatWadlLinkJSON), - Value: to.Ptr("https://developer.cisco.com/media/wae-release-6-2-api-reference/wae-collector-rest-api/application.wadl"), - }, - }, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("collectorwadl"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/collectorwadl"), - // Properties: &armapimanagement.APIContractProperties{ - // Description: to.Ptr(""), - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // Path: to.Ptr("collector"), - // DisplayName: to.Ptr("http://localhost:8080/collector-northbound"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://localhost:8080/collector-northbound"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiWithOpenIdConnect.json -func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiWithOpenIdConnect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "tempgroup", armapimanagement.APICreateOrUpdateParameter{ - Properties: &armapimanagement.APICreateOrUpdateProperties{ - Description: to.Ptr("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."), - AuthenticationSettings: &armapimanagement.AuthenticationSettingsContract{ - Openid: &armapimanagement.OpenIDAuthenticationSettingsContract{ - BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethods{ - to.Ptr(armapimanagement.BearerTokenSendingMethodsAuthorizationHeader)}, - OpenidProviderID: to.Ptr("testopenid"), - }, - }, - SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - Header: to.Ptr("Ocp-Apim-Subscription-Key"), - Query: to.Ptr("subscription-key"), - }, - Path: to.Ptr("petstore"), - DisplayName: to.Ptr("Swagger Petstore"), - Protocols: []*armapimanagement.Protocol{ - to.Ptr(armapimanagement.ProtocolHTTPS)}, - ServiceURL: to.Ptr("http://petstore.swagger.io/v2"), - }, - }, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("58da4c4ccdae970a08121230"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58da4c4ccdae970a08121230"), - // Properties: &armapimanagement.APIContractProperties{ - // Description: to.Ptr("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."), - // APIRevision: to.Ptr("1"), - // AuthenticationSettings: &armapimanagement.AuthenticationSettingsContract{ - // Openid: &armapimanagement.OpenIDAuthenticationSettingsContract{ - // BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethods{ - // to.Ptr(armapimanagement.BearerTokenSendingMethodsAuthorizationHeader)}, - // OpenidProviderID: to.Ptr("testopenid"), - // }, - // }, - // IsCurrent: to.Ptr(true), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // Path: to.Ptr("petstore"), - // DisplayName: to.Ptr("Swagger Petstore"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://petstore.swagger.io/v2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGraphQLApi.json -func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateGraphQlApi() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "tempgroup", armapimanagement.APICreateOrUpdateParameter{ - Properties: &armapimanagement.APICreateOrUpdateProperties{ - APIType: to.Ptr(armapimanagement.APITypeGraphql), - Description: to.Ptr("apidescription5200"), - Path: to.Ptr("graphql-api"), - DisplayName: to.Ptr("apiname1463"), - Protocols: []*armapimanagement.Protocol{ - to.Ptr(armapimanagement.ProtocolHTTP), - to.Ptr(armapimanagement.ProtocolHTTPS)}, - ServiceURL: to.Ptr("https://api.spacex.land/graphql"), - }, - }, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("apiid9419"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419"), - // Properties: &armapimanagement.APIContractProperties{ - // APIType: to.Ptr(armapimanagement.APITypeGraphql), - // Description: to.Ptr("apidescription5200"), - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // IsOnline: to.Ptr(true), - // Path: to.Ptr("graphql-api"), - // DisplayName: to.Ptr("apiname1463"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTP), - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("https://api.spacex.land/graphql"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateSoapPassThroughApiUsingWsdlImport.json -func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateSoapPassThroughApiUsingWsdlImport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "soapApi", armapimanagement.APICreateOrUpdateParameter{ - Properties: &armapimanagement.APICreateOrUpdateProperties{ - Path: to.Ptr("currency"), - Format: to.Ptr(armapimanagement.ContentFormatWsdlLink), - SoapAPIType: to.Ptr(armapimanagement.SoapAPITypeSoapPassThrough), - Value: to.Ptr("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"), - WsdlSelector: &armapimanagement.APICreateOrUpdatePropertiesWsdlSelector{ - WsdlEndpointName: to.Ptr("CurrencyConvertorSoap"), - WsdlServiceName: to.Ptr("CurrencyConvertor"), - }, - }, - }, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("soapApi"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/soapApi"), - // Properties: &armapimanagement.APIContractProperties{ - // APIType: to.Ptr(armapimanagement.APITypeSoap), - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // Path: to.Ptr("currency"), - // DisplayName: to.Ptr("CurrencyConvertor"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://www.webservicex.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateSoapToRestApiUsingWsdlImport.json -func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateSoapToRestApiUsingWsdlImport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "soapApi", armapimanagement.APICreateOrUpdateParameter{ - Properties: &armapimanagement.APICreateOrUpdateProperties{ - Path: to.Ptr("currency"), - Format: to.Ptr(armapimanagement.ContentFormatWsdlLink), - Value: to.Ptr("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"), - WsdlSelector: &armapimanagement.APICreateOrUpdatePropertiesWsdlSelector{ - WsdlEndpointName: to.Ptr("CurrencyConvertorSoap"), - WsdlServiceName: to.Ptr("CurrencyConvertor"), - }, - }, - }, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("soapApi"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/soapApi"), - // Properties: &armapimanagement.APIContractProperties{ - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // Path: to.Ptr("currency"), - // DisplayName: to.Ptr("CurrencyConvertor"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://www.webservicex.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateWebsocketApi.json -func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateWebSocketApi() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "tempgroup", armapimanagement.APICreateOrUpdateParameter{ - Properties: &armapimanagement.APICreateOrUpdateProperties{ - APIType: to.Ptr(armapimanagement.APITypeWebsocket), - Description: to.Ptr("apidescription5200"), - Path: to.Ptr("newapiPath"), - DisplayName: to.Ptr("apiname1463"), - Protocols: []*armapimanagement.Protocol{ - to.Ptr(armapimanagement.ProtocolWss), - to.Ptr(armapimanagement.ProtocolWs)}, - ServiceURL: to.Ptr("wss://echo.websocket.org"), - }, - }, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("apiid9419"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419"), - // Properties: &armapimanagement.APIContractProperties{ - // APIType: to.Ptr(armapimanagement.APITypeWebsocket), - // Description: to.Ptr("apidescription5200"), - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // IsOnline: to.Ptr(true), - // Path: to.Ptr("newapiPath"), - // DisplayName: to.Ptr("apiname1463"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolWs), - // to.Ptr(armapimanagement.ProtocolWss)}, - // ServiceURL: to.Ptr("wss://echo.websocket.org"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApi.json -func ExampleAPIClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIClient().Update(ctx, "rg1", "apimService1", "echo-api", "*", armapimanagement.APIUpdateContract{ - Properties: &armapimanagement.APIContractUpdateProperties{ - Path: to.Ptr("newecho"), - DisplayName: to.Ptr("Echo API New"), - ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api2"), - }, - }, 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("echo-api"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"), - // Properties: &armapimanagement.APIContractProperties{ - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // IsOnline: to.Ptr(true), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // Path: to.Ptr("newecho"), - // DisplayName: to.Ptr("Echo API New"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApi.json -func ExampleAPIClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIClient().Delete(ctx, "rg1", "apimService1", "echo-api", "*", &armapimanagement.APIClientDeleteOptions{DeleteRevisions: 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApisByTags.json -func ExampleAPIClient_NewListByTagsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIClient().NewListByTagsPager("rg1", "apimService1", &armapimanagement.APIClientListByTagsOptions{Filter: nil, - Top: nil, - Skip: nil, - IncludeNotTaggedApis: 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.TagResourceCollection = armapimanagement.TagResourceCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.TagResourceContract{ - // { - // API: &armapimanagement.APITagResourceContractProperties{ - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // Name: to.Ptr("Echo API"), - // Path: to.Ptr("echo"), - // ID: to.Ptr("/apis/echo-api"), - // ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api"), - // }, - // Tag: &armapimanagement.TagResourceContractProperties{ - // Name: to.Ptr("awesomeTag"), - // ID: to.Ptr("/tags/apitag123"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apidiagnostic_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apidiagnostic_client.go index 0d5ec13489a5..7f6b4ca38d0c 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apidiagnostic_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apidiagnostic_client.go @@ -30,8 +30,7 @@ type APIDiagnosticClient struct { } // NewAPIDiagnosticClient creates a new instance of APIDiagnosticClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPIDiagnosticClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIDiagnosticClient, error) { @@ -49,8 +48,8 @@ func NewAPIDiagnosticClient(subscriptionID string, credential azcore.TokenCreden // CreateOrUpdate - Creates a new Diagnostic for an API or updates an existing one. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - diagnosticID - Diagnostic identifier. Must be unique in the current API Management service instance. @@ -100,7 +99,7 @@ func (client *APIDiagnosticClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -124,8 +123,8 @@ func (client *APIDiagnosticClient) createOrUpdateHandleResponse(resp *http.Respo // Delete - Deletes the specified Diagnostic from an API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - diagnosticID - Diagnostic identifier. Must be unique in the current API Management service instance. @@ -175,7 +174,7 @@ func (client *APIDiagnosticClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -185,8 +184,8 @@ func (client *APIDiagnosticClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets the details of the Diagnostic for an API specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - diagnosticID - Diagnostic identifier. Must be unique in the current API Management service instance. @@ -234,7 +233,7 @@ func (client *APIDiagnosticClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,8 +253,8 @@ func (client *APIDiagnosticClient) getHandleResponse(resp *http.Response) (APIDi // GetEntityTag - Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - diagnosticID - Diagnostic identifier. Must be unique in the current API Management service instance. @@ -304,7 +303,7 @@ func (client *APIDiagnosticClient) getEntityTagCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,8 +321,8 @@ func (client *APIDiagnosticClient) getEntityTagHandleResponse(resp *http.Respons // NewListByServicePager - Lists all diagnostics of an API. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - options - APIDiagnosticClientListByServiceOptions contains the optional parameters for the APIDiagnosticClient.NewListByServicePager @@ -389,7 +388,7 @@ func (client *APIDiagnosticClient) listByServiceCreateRequest(ctx context.Contex if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -407,8 +406,8 @@ func (client *APIDiagnosticClient) listByServiceHandleResponse(resp *http.Respon // Update - Updates the details of the Diagnostic for an API specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - diagnosticID - Diagnostic identifier. Must be unique in the current API Management service instance. @@ -459,7 +458,7 @@ func (client *APIDiagnosticClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apidiagnostic_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/apidiagnostic_client_example_test.go deleted file mode 100644 index fde0cd88710b..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apidiagnostic_client_example_test.go +++ /dev/null @@ -1,413 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiDiagnostics.json -func ExampleAPIDiagnosticClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIDiagnosticClient().NewListByServicePager("rg1", "apimService1", "echo-api", &armapimanagement.APIDiagnosticClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.DiagnosticCollection = armapimanagement.DiagnosticCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.DiagnosticContract{ - // { - // Name: to.Ptr("applicationinsights"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/diagnostics"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api/diagnostics/applicationinsights"), - // Properties: &armapimanagement.DiagnosticContractProperties{ - // AlwaysLog: to.Ptr(armapimanagement.AlwaysLogAllErrors), - // Backend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // }, - // Frontend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // }, - // HTTPCorrelationProtocol: to.Ptr(armapimanagement.HTTPCorrelationProtocolLegacy), - // LogClientIP: to.Ptr(true), - // LoggerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/aisamplingtest"), - // Sampling: &armapimanagement.SamplingSettings{ - // Percentage: to.Ptr[float64](100), - // SamplingType: to.Ptr(armapimanagement.SamplingTypeFixed), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiDiagnostic.json -func ExampleAPIDiagnosticClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIDiagnosticClient().GetEntityTag(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", "applicationinsights", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiDiagnostic.json -func ExampleAPIDiagnosticClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIDiagnosticClient().Get(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", "applicationinsights", 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.DiagnosticContract = armapimanagement.DiagnosticContract{ - // Name: to.Ptr("applicationinsights"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/diagnostics"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api/diagnostics/applicationinsights"), - // Properties: &armapimanagement.DiagnosticContractProperties{ - // AlwaysLog: to.Ptr(armapimanagement.AlwaysLogAllErrors), - // Backend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // }, - // Frontend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // }, - // HTTPCorrelationProtocol: to.Ptr(armapimanagement.HTTPCorrelationProtocolLegacy), - // LogClientIP: to.Ptr(true), - // LoggerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/aisamplingtest"), - // Sampling: &armapimanagement.SamplingSettings{ - // Percentage: to.Ptr[float64](100), - // SamplingType: to.Ptr(armapimanagement.SamplingTypeFixed), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiDiagnostic.json -func ExampleAPIDiagnosticClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIDiagnosticClient().CreateOrUpdate(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", "applicationinsights", armapimanagement.DiagnosticContract{ - Properties: &armapimanagement.DiagnosticContractProperties{ - AlwaysLog: to.Ptr(armapimanagement.AlwaysLogAllErrors), - Backend: &armapimanagement.PipelineDiagnosticSettings{ - Response: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - Request: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - }, - Frontend: &armapimanagement.PipelineDiagnosticSettings{ - Response: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - Request: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - }, - LoggerID: to.Ptr("/loggers/applicationinsights"), - Sampling: &armapimanagement.SamplingSettings{ - Percentage: to.Ptr[float64](50), - SamplingType: to.Ptr(armapimanagement.SamplingTypeFixed), - }, - }, - }, &armapimanagement.APIDiagnosticClientCreateOrUpdateOptions{IfMatch: 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.DiagnosticContract = armapimanagement.DiagnosticContract{ - // Name: to.Ptr("applicationinsights"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/diagnostics"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a/diagnostics/applicationinsights"), - // Properties: &armapimanagement.DiagnosticContractProperties{ - // AlwaysLog: to.Ptr(armapimanagement.AlwaysLogAllErrors), - // Backend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](512), - // }, - // Headers: []*string{ - // to.Ptr("Content-type")}, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](512), - // }, - // Headers: []*string{ - // to.Ptr("Content-type")}, - // }, - // }, - // Frontend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](512), - // }, - // Headers: []*string{ - // to.Ptr("Content-type")}, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](512), - // }, - // Headers: []*string{ - // to.Ptr("Content-type")}, - // }, - // }, - // LoggerID: to.Ptr("/loggers/applicationinsights"), - // Sampling: &armapimanagement.SamplingSettings{ - // Percentage: to.Ptr[float64](50), - // SamplingType: to.Ptr(armapimanagement.SamplingTypeFixed), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiDiagnostic.json -func ExampleAPIDiagnosticClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIDiagnosticClient().Update(ctx, "rg1", "apimService1", "echo-api", "applicationinsights", "*", armapimanagement.DiagnosticContract{ - Properties: &armapimanagement.DiagnosticContractProperties{ - AlwaysLog: to.Ptr(armapimanagement.AlwaysLogAllErrors), - Backend: &armapimanagement.PipelineDiagnosticSettings{ - Response: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - Request: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - }, - Frontend: &armapimanagement.PipelineDiagnosticSettings{ - Response: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - Request: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - }, - LoggerID: to.Ptr("/loggers/applicationinsights"), - Sampling: &armapimanagement.SamplingSettings{ - Percentage: to.Ptr[float64](50), - SamplingType: to.Ptr(armapimanagement.SamplingTypeFixed), - }, - }, - }, 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.DiagnosticContract = armapimanagement.DiagnosticContract{ - // Name: to.Ptr("applicationinsights"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/diagnostics"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api/diagnostics/applicationinsights"), - // Properties: &armapimanagement.DiagnosticContractProperties{ - // AlwaysLog: to.Ptr(armapimanagement.AlwaysLogAllErrors), - // Backend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // }, - // Frontend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // }, - // HTTPCorrelationProtocol: to.Ptr(armapimanagement.HTTPCorrelationProtocolLegacy), - // LogClientIP: to.Ptr(true), - // LoggerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/aisamplingtest"), - // Sampling: &armapimanagement.SamplingSettings{ - // Percentage: to.Ptr[float64](100), - // SamplingType: to.Ptr(armapimanagement.SamplingTypeFixed), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiDiagnostic.json -func ExampleAPIDiagnosticClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIDiagnosticClient().Delete(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", "applicationinsights", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apiexport_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apiexport_client.go index 3f2a24f78aad..28dcd467f5bf 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apiexport_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apiexport_client.go @@ -29,8 +29,7 @@ type APIExportClient struct { } // NewAPIExportClient creates a new instance of APIExportClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPIExportClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIExportClient, error) { @@ -49,12 +48,13 @@ func NewAPIExportClient(subscriptionID string, credential azcore.TokenCredential // valid for 5 minutes. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. -// - formatParam - Format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 minutes. +// - formatParam - Format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 minutes. New formats +// can be added in the future. // - export - Query parameter required to export the API details. // - options - APIExportClientGetOptions contains the optional parameters for the APIExportClient.Get method. func (client *APIExportClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiID string, formatParam ExportFormat, export ExportAPI, options *APIExportClientGetOptions) (APIExportClientGetResponse, error) { @@ -98,7 +98,7 @@ func (client *APIExportClient) getCreateRequest(ctx context.Context, resourceGro reqQP := req.Raw().URL.Query() reqQP.Set("format", string(formatParam)) reqQP.Set("export", string(export)) - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apiexport_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/apiexport_client_example_test.go deleted file mode 100644 index 0e0ce6f76c01..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apiexport_client_example_test.go +++ /dev/null @@ -1,72 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiExportInOpenApi2dot0.json -func ExampleAPIExportClient_Get_apiManagementGetApiExportInOpenApi2Dot0() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIExportClient().Get(ctx, "rg1", "apimService1", "echo-api", armapimanagement.ExportFormatSwagger, armapimanagement.ExportAPITrue, 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.APIExportResult = armapimanagement.APIExportResult{ - // ExportResultFormat: to.Ptr(armapimanagement.ExportResultFormatSwagger), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"), - // Value: &armapimanagement.APIExportResultValue{ - // Link: to.Ptr("https://apimgmtstkjpszxxxxxxx.blob.core.windows.net/api-export/Swagger Petstore Extensive.json?sv=2015-07-08&sr=b&sig=mxhLsFuOonu8EXIjyFPV%2FnDra0qTIoip7N7MuU%2BTFsA%3D&se=2019-04-10T22:41:31Z&sp=r"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiExportInOpenApi3dot0.json -func ExampleAPIExportClient_Get_apiManagementGetApiExportInOpenApi3Dot0() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIExportClient().Get(ctx, "rg1", "apimService1", "aid9676", armapimanagement.ExportFormatOpenapi, armapimanagement.ExportAPITrue, 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.APIExportResult = armapimanagement.APIExportResult{ - // ExportResultFormat: to.Ptr(armapimanagement.ExportResultFormatOpenAPI), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/aid9676"), - // Value: &armapimanagement.APIExportResultValue{ - // Link: to.Ptr("https: //apimgmtstkjpszxxxxxxx.blob.core.windows.net/api-export/Swagger Petstore.yaml?sv=2015-07-08&sr=b&sig=qqtR1y5iTbz5P7USBduqB5vriIU4gmiGqe0lKVV8j9k%3D&se=2019-04-10T22:40:57Z&sp=r"), - // }, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apiissue_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apiissue_client.go index 030895e29b77..b40ac9bd1c3a 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apiissue_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apiissue_client.go @@ -30,8 +30,7 @@ type APIIssueClient struct { } // NewAPIIssueClient creates a new instance of APIIssueClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPIIssueClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIIssueClient, error) { @@ -49,8 +48,8 @@ func NewAPIIssueClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Creates a new Issue for an API or updates an existing one. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -99,7 +98,7 @@ func (client *APIIssueClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -123,8 +122,8 @@ func (client *APIIssueClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Deletes the specified Issue from an API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -174,7 +173,7 @@ func (client *APIIssueClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -184,8 +183,8 @@ func (client *APIIssueClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Gets the details of the Issue for an API specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -236,7 +235,7 @@ func (client *APIIssueClient) getCreateRequest(ctx context.Context, resourceGrou if options != nil && options.ExpandCommentsAttachments != nil { reqQP.Set("expandCommentsAttachments", strconv.FormatBool(*options.ExpandCommentsAttachments)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -256,8 +255,8 @@ func (client *APIIssueClient) getHandleResponse(resp *http.Response) (APIIssueCl // GetEntityTag - Gets the entity state (Etag) version of the Issue for an API specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -305,7 +304,7 @@ func (client *APIIssueClient) getEntityTagCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -323,8 +322,8 @@ func (client *APIIssueClient) getEntityTagHandleResponse(resp *http.Response) (A // NewListByServicePager - Lists all issues associated with the specified API. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - options - APIIssueClientListByServiceOptions contains the optional parameters for the APIIssueClient.NewListByServicePager @@ -393,7 +392,7 @@ func (client *APIIssueClient) listByServiceCreateRequest(ctx context.Context, re if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -411,8 +410,8 @@ func (client *APIIssueClient) listByServiceHandleResponse(resp *http.Response) ( // Update - Updates an existing issue for an API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -463,7 +462,7 @@ func (client *APIIssueClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apiissue_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/apiissue_client_example_test.go deleted file mode 100644 index e45b7b0787de..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apiissue_client_example_test.go +++ /dev/null @@ -1,211 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "time" - - "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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiIssues.json -func ExampleAPIIssueClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIIssueClient().NewListByServicePager("rg1", "apimService1", "57d1f7558aa04f15146d9d8a", &armapimanagement.APIIssueClientListByServiceOptions{Filter: nil, - ExpandCommentsAttachments: nil, - Top: nil, - Skip: 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.IssueCollection = armapimanagement.IssueCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.IssueContract{ - // { - // Name: to.Ptr("57d2ef278aa04f0ad01d6cdc"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/issues"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a/issues/57d2ef278aa04f0ad01d6cdc"), - // Properties: &armapimanagement.IssueContractProperties{ - // APIID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a"), - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-01T22:21:20.467Z"); return t}()), - // State: to.Ptr(armapimanagement.StateOpen), - // Description: to.Ptr("New API issue description"), - // Title: to.Ptr("New API issue"), - // UserID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiIssue.json -func ExampleAPIIssueClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIIssueClient().GetEntityTag(ctx, "rg1", "apimService1", "57d2ef278aa04f0888cba3f3", "57d2ef278aa04f0ad01d6cdc", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssue.json -func ExampleAPIIssueClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIIssueClient().Get(ctx, "rg1", "apimService1", "57d2ef278aa04f0888cba3f3", "57d2ef278aa04f0ad01d6cdc", &armapimanagement.APIIssueClientGetOptions{ExpandCommentsAttachments: 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.IssueContract = armapimanagement.IssueContract{ - // Name: to.Ptr("57d2ef278aa04f0ad01d6cdc"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/issues"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a/issues/57d2ef278aa04f0ad01d6cdc"), - // Properties: &armapimanagement.IssueContractProperties{ - // APIID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a"), - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-01T22:21:20.467Z"); return t}()), - // State: to.Ptr(armapimanagement.StateOpen), - // Description: to.Ptr("New API issue description"), - // Title: to.Ptr("New API issue"), - // UserID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiIssue.json -func ExampleAPIIssueClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIIssueClient().CreateOrUpdate(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", "57d2ef278aa04f0ad01d6cdc", armapimanagement.IssueContract{ - Properties: &armapimanagement.IssueContractProperties{ - CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-01T22:21:20.467Z"); return t }()), - State: to.Ptr(armapimanagement.StateOpen), - Description: to.Ptr("New API issue description"), - Title: to.Ptr("New API issue"), - UserID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - }, - }, &armapimanagement.APIIssueClientCreateOrUpdateOptions{IfMatch: 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.IssueContract = armapimanagement.IssueContract{ - // Name: to.Ptr("57d2ef278aa04f0ad01d6cdc"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/issues"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a/issues/57d2ef278aa04f0ad01d6cdc"), - // Properties: &armapimanagement.IssueContractProperties{ - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-01T22:21:20.467Z"); return t}()), - // State: to.Ptr(armapimanagement.StateOpen), - // Description: to.Ptr("New API issue description"), - // Title: to.Ptr("New API issue"), - // UserID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiIssue.json -func ExampleAPIIssueClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIIssueClient().Update(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", "57d2ef278aa04f0ad01d6cdc", "*", armapimanagement.IssueUpdateContract{ - Properties: &armapimanagement.IssueUpdateContractProperties{ - State: to.Ptr(armapimanagement.StateClosed), - }, - }, 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.IssueContract = armapimanagement.IssueContract{ - // Name: to.Ptr("57d2ef278aa04f0ad01d6cdc"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/issues"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a/issues/57d2ef278aa04f0ad01d6cdc"), - // Properties: &armapimanagement.IssueContractProperties{ - // APIID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a"), - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-01T22:21:20.467Z"); return t}()), - // State: to.Ptr(armapimanagement.StateOpen), - // Description: to.Ptr("New API issue description"), - // Title: to.Ptr("New API issue"), - // UserID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiIssue.json -func ExampleAPIIssueClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIIssueClient().Delete(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", "57d2ef278aa04f0ad01d6cdc", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apiissueattachment_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apiissueattachment_client.go index 8f865ad9990e..7b983e966b28 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apiissueattachment_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apiissueattachment_client.go @@ -30,8 +30,7 @@ type APIIssueAttachmentClient struct { } // NewAPIIssueAttachmentClient creates a new instance of APIIssueAttachmentClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPIIssueAttachmentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIIssueAttachmentClient, error) { @@ -49,8 +48,8 @@ func NewAPIIssueAttachmentClient(subscriptionID string, credential azcore.TokenC // CreateOrUpdate - Creates a new Attachment for the Issue in an API or updates an existing one. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -105,7 +104,7 @@ func (client *APIIssueAttachmentClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -129,8 +128,8 @@ func (client *APIIssueAttachmentClient) createOrUpdateHandleResponse(resp *http. // Delete - Deletes the specified comment from an Issue. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -186,7 +185,7 @@ func (client *APIIssueAttachmentClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -196,8 +195,8 @@ func (client *APIIssueAttachmentClient) deleteCreateRequest(ctx context.Context, // Get - Gets the details of the issue Attachment for an API specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -250,7 +249,7 @@ func (client *APIIssueAttachmentClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -270,8 +269,8 @@ func (client *APIIssueAttachmentClient) getHandleResponse(resp *http.Response) ( // GetEntityTag - Gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -325,7 +324,7 @@ func (client *APIIssueAttachmentClient) getEntityTagCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -343,8 +342,8 @@ func (client *APIIssueAttachmentClient) getEntityTagHandleResponse(resp *http.Re // NewListByServicePager - Lists all attachments for the Issue associated with the specified API. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -415,7 +414,7 @@ func (client *APIIssueAttachmentClient) listByServiceCreateRequest(ctx context.C if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apiissueattachment_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/apiissueattachment_client_example_test.go deleted file mode 100644 index 5dc86dcd712b..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apiissueattachment_client_example_test.go +++ /dev/null @@ -1,161 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiIssueAttachments.json -func ExampleAPIIssueAttachmentClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIIssueAttachmentClient().NewListByServicePager("rg1", "apimService1", "57d1f7558aa04f15146d9d8a", "57d2ef278aa04f0ad01d6cdc", &armapimanagement.APIIssueAttachmentClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.IssueAttachmentCollection = armapimanagement.IssueAttachmentCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.IssueAttachmentContract{ - // { - // Name: to.Ptr("57d2ef278aa04f0888cba3f3"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/issues/attachments"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a/issues/57d2ef278aa04f0ad01d6cdc/attachments/57d2ef278aa04f0888cba3f3"), - // Properties: &armapimanagement.IssueAttachmentContractProperties{ - // Content: to.Ptr("https://.../image.jpg"), - // ContentFormat: to.Ptr("link"), - // Title: to.Ptr("Issue attachment."), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiIssueAttachment.json -func ExampleAPIIssueAttachmentClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIIssueAttachmentClient().GetEntityTag(ctx, "rg1", "apimService1", "57d2ef278aa04f0888cba3f3", "57d2ef278aa04f0ad01d6cdc", "57d2ef278aa04f0888cba3f3", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssueAttachment.json -func ExampleAPIIssueAttachmentClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIIssueAttachmentClient().Get(ctx, "rg1", "apimService1", "57d2ef278aa04f0888cba3f3", "57d2ef278aa04f0ad01d6cdc", "57d2ef278aa04f0888cba3f3", 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.IssueAttachmentContract = armapimanagement.IssueAttachmentContract{ - // Name: to.Ptr("57d2ef278aa04f0888cba3f3"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/issues/attachments"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a/issues/57d2ef278aa04f0ad01d6cdc/attachments/57d2ef278aa04f0888cba3f3"), - // Properties: &armapimanagement.IssueAttachmentContractProperties{ - // Content: to.Ptr("https://.../image.jpg"), - // ContentFormat: to.Ptr("link"), - // Title: to.Ptr("Issue attachment."), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiIssueAttachment.json -func ExampleAPIIssueAttachmentClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIIssueAttachmentClient().CreateOrUpdate(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", "57d2ef278aa04f0ad01d6cdc", "57d2ef278aa04f0888cba3f3", armapimanagement.IssueAttachmentContract{ - Properties: &armapimanagement.IssueAttachmentContractProperties{ - Content: to.Ptr("IEJhc2U2NA=="), - ContentFormat: to.Ptr("image/jpeg"), - Title: to.Ptr("Issue attachment."), - }, - }, &armapimanagement.APIIssueAttachmentClientCreateOrUpdateOptions{IfMatch: 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.IssueAttachmentContract = armapimanagement.IssueAttachmentContract{ - // Name: to.Ptr("57d2ef278aa04f0888cba3f3"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/issues/attachments"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a/issues/57d2ef278aa04f0ad01d6cdc/attachments/57d2ef278aa04f0888cba3f3"), - // Properties: &armapimanagement.IssueAttachmentContractProperties{ - // Content: to.Ptr("https://.../image.jpg"), - // ContentFormat: to.Ptr("link"), - // Title: to.Ptr("Issue attachment."), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiIssueAttachment.json -func ExampleAPIIssueAttachmentClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIIssueAttachmentClient().Delete(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", "57d2ef278aa04f0ad01d6cdc", "57d2ef278aa04f0888cba3f3", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apiissuecomment_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apiissuecomment_client.go index 5f0bad8bc474..f57bca45d7b2 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apiissuecomment_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apiissuecomment_client.go @@ -30,8 +30,7 @@ type APIIssueCommentClient struct { } // NewAPIIssueCommentClient creates a new instance of APIIssueCommentClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPIIssueCommentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIIssueCommentClient, error) { @@ -49,8 +48,8 @@ func NewAPIIssueCommentClient(subscriptionID string, credential azcore.TokenCred // CreateOrUpdate - Creates a new Comment for the Issue in an API or updates an existing one. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -105,7 +104,7 @@ func (client *APIIssueCommentClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -129,8 +128,8 @@ func (client *APIIssueCommentClient) createOrUpdateHandleResponse(resp *http.Res // Delete - Deletes the specified comment from an Issue. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -185,7 +184,7 @@ func (client *APIIssueCommentClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -195,8 +194,8 @@ func (client *APIIssueCommentClient) deleteCreateRequest(ctx context.Context, re // Get - Gets the details of the issue Comment for an API specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -249,7 +248,7 @@ func (client *APIIssueCommentClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,8 +268,8 @@ func (client *APIIssueCommentClient) getHandleResponse(resp *http.Response) (API // GetEntityTag - Gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -324,7 +323,7 @@ func (client *APIIssueCommentClient) getEntityTagCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -342,8 +341,8 @@ func (client *APIIssueCommentClient) getEntityTagHandleResponse(resp *http.Respo // NewListByServicePager - Lists all comments for the Issue associated with the specified API. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - issueID - Issue identifier. Must be unique in the current API Management service instance. @@ -414,7 +413,7 @@ func (client *APIIssueCommentClient) listByServiceCreateRequest(ctx context.Cont if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apiissuecomment_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/apiissuecomment_client_example_test.go deleted file mode 100644 index 0058bb14b324..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apiissuecomment_client_example_test.go +++ /dev/null @@ -1,163 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "time" - - "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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiIssueComments.json -func ExampleAPIIssueCommentClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIIssueCommentClient().NewListByServicePager("rg1", "apimService1", "57d1f7558aa04f15146d9d8a", "57d2ef278aa04f0ad01d6cdc", &armapimanagement.APIIssueCommentClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.IssueCommentCollection = armapimanagement.IssueCommentCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.IssueCommentContract{ - // { - // Name: to.Ptr("599e29ab193c3c0bd0b3e2fb"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/issues/comments"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a/issues/57d2ef278aa04f0ad01d6cdc/comments/599e29ab193c3c0bd0b3e2fb"), - // Properties: &armapimanagement.IssueCommentContractProperties{ - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-01T22:21:20.467Z"); return t}()), - // Text: to.Ptr("Issue comment."), - // UserID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiIssueComment.json -func ExampleAPIIssueCommentClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIIssueCommentClient().GetEntityTag(ctx, "rg1", "apimService1", "57d2ef278aa04f0888cba3f3", "57d2ef278aa04f0ad01d6cdc", "599e29ab193c3c0bd0b3e2fb", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssueComment.json -func ExampleAPIIssueCommentClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIIssueCommentClient().Get(ctx, "rg1", "apimService1", "57d2ef278aa04f0888cba3f3", "57d2ef278aa04f0ad01d6cdc", "599e29ab193c3c0bd0b3e2fb", 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.IssueCommentContract = armapimanagement.IssueCommentContract{ - // Name: to.Ptr("599e29ab193c3c0bd0b3e2fb"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/issues/comments"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a/issues/57d2ef278aa04f0ad01d6cdc/comments/599e29ab193c3c0bd0b3e2fb"), - // Properties: &armapimanagement.IssueCommentContractProperties{ - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-01T22:21:20.467Z"); return t}()), - // Text: to.Ptr("Issue comment."), - // UserID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiIssueComment.json -func ExampleAPIIssueCommentClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIIssueCommentClient().CreateOrUpdate(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", "57d2ef278aa04f0ad01d6cdc", "599e29ab193c3c0bd0b3e2fb", armapimanagement.IssueCommentContract{ - Properties: &armapimanagement.IssueCommentContractProperties{ - CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-01T22:21:20.467Z"); return t }()), - Text: to.Ptr("Issue comment."), - UserID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - }, - }, &armapimanagement.APIIssueCommentClientCreateOrUpdateOptions{IfMatch: 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.IssueCommentContract = armapimanagement.IssueCommentContract{ - // Name: to.Ptr("599e29ab193c3c0bd0b3e2fb"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/issues/comments"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a/issues/57d2ef278aa04f0ad01d6cdc/comments/599e29ab193c3c0bd0b3e2fb"), - // Properties: &armapimanagement.IssueCommentContractProperties{ - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-01T22:21:20.467Z"); return t}()), - // Text: to.Ptr("Issue comment."), - // UserID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiIssueComment.json -func ExampleAPIIssueCommentClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIIssueCommentClient().Delete(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", "57d2ef278aa04f0ad01d6cdc", "599e29ab193c3c0bd0b3e2fb", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apioperation_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apioperation_client.go index f5558cd5dd1f..41551196cfed 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apioperation_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apioperation_client.go @@ -30,8 +30,7 @@ type APIOperationClient struct { } // NewAPIOperationClient creates a new instance of APIOperationClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPIOperationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIOperationClient, error) { @@ -49,8 +48,8 @@ func NewAPIOperationClient(subscriptionID string, credential azcore.TokenCredent // CreateOrUpdate - Creates a new operation in the API or updates an existing one. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -101,7 +100,7 @@ func (client *APIOperationClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -125,8 +124,8 @@ func (client *APIOperationClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Deletes the specified operation in the API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -177,7 +176,7 @@ func (client *APIOperationClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -187,8 +186,8 @@ func (client *APIOperationClient) deleteCreateRequest(ctx context.Context, resou // Get - Gets the details of the API Operation specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -237,7 +236,7 @@ func (client *APIOperationClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -257,8 +256,8 @@ func (client *APIOperationClient) getHandleResponse(resp *http.Response) (APIOpe // GetEntityTag - Gets the entity state (Etag) version of the API operation specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -308,7 +307,7 @@ func (client *APIOperationClient) getEntityTagCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -326,8 +325,8 @@ func (client *APIOperationClient) getEntityTagHandleResponse(resp *http.Response // NewListByAPIPager - Lists a collection of the operations for the specified API. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -397,7 +396,7 @@ func (client *APIOperationClient) listByAPICreateRequest(ctx context.Context, re if options != nil && options.Tags != nil { reqQP.Set("tags", *options.Tags) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -415,8 +414,8 @@ func (client *APIOperationClient) listByAPIHandleResponse(resp *http.Response) ( // Update - Updates the details of the operation in the API specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -468,7 +467,7 @@ func (client *APIOperationClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apioperation_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/apioperation_client_example_test.go deleted file mode 100644 index 6dbfd504a85f..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apioperation_client_example_test.go +++ /dev/null @@ -1,476 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiOperations.json -func ExampleAPIOperationClient_NewListByAPIPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIOperationClient().NewListByAPIPager("rg1", "apimService1", "57d2ef278aa04f0888cba3f3", &armapimanagement.APIOperationClientListByAPIOptions{Filter: nil, - Top: nil, - Skip: nil, - Tags: 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.OperationCollection = armapimanagement.OperationCollection{ - // Count: to.Ptr[int64](5), - // Value: []*armapimanagement.OperationContract{ - // { - // Name: to.Ptr("57d2ef278aa04f0ad01d6cdc"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/operations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d2ef278aa04f0888cba3f3/operations/57d2ef278aa04f0ad01d6cdc"), - // Properties: &armapimanagement.OperationContractProperties{ - // Method: to.Ptr("POST"), - // DisplayName: to.Ptr("CancelOrder"), - // URLTemplate: to.Ptr("/?soapAction=http://tempuri.org/IFazioService/CancelOrder"), - // }, - // }, - // { - // Name: to.Ptr("57d2ef278aa04f0ad01d6cda"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/operations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d2ef278aa04f0888cba3f3/operations/57d2ef278aa04f0ad01d6cda"), - // Properties: &armapimanagement.OperationContractProperties{ - // Method: to.Ptr("POST"), - // DisplayName: to.Ptr("GetMostRecentOrder"), - // URLTemplate: to.Ptr("/?soapAction=http://tempuri.org/IFazioService/GetMostRecentOrder"), - // }, - // }, - // { - // Name: to.Ptr("57d2ef278aa04f0ad01d6cd9"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/operations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d2ef278aa04f0888cba3f3/operations/57d2ef278aa04f0ad01d6cd9"), - // Properties: &armapimanagement.OperationContractProperties{ - // Method: to.Ptr("POST"), - // DisplayName: to.Ptr("GetOpenOrders"), - // URLTemplate: to.Ptr("/?soapAction=http://tempuri.org/IFazioService/GetOpenOrders"), - // }, - // }, - // { - // Name: to.Ptr("57d2ef278aa04f0ad01d6cdb"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/operations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d2ef278aa04f0888cba3f3/operations/57d2ef278aa04f0ad01d6cdb"), - // Properties: &armapimanagement.OperationContractProperties{ - // Method: to.Ptr("POST"), - // DisplayName: to.Ptr("GetOrder"), - // URLTemplate: to.Ptr("/?soapAction=http://tempuri.org/IFazioService/GetOrder"), - // }, - // }, - // { - // Name: to.Ptr("57d2ef278aa04f0ad01d6cd8"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/operations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d2ef278aa04f0888cba3f3/operations/57d2ef278aa04f0ad01d6cd8"), - // Properties: &armapimanagement.OperationContractProperties{ - // Method: to.Ptr("POST"), - // DisplayName: to.Ptr("submitOrder"), - // URLTemplate: to.Ptr("/?soapAction=http://tempuri.org/IFazioService/submitOrder"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiOperation.json -func ExampleAPIOperationClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIOperationClient().GetEntityTag(ctx, "rg1", "apimService1", "57d2ef278aa04f0888cba3f3", "57d2ef278aa04f0ad01d6cdc", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperation.json -func ExampleAPIOperationClient_Get_apiManagementGetApiOperation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIOperationClient().Get(ctx, "rg1", "apimService1", "57d2ef278aa04f0888cba3f3", "57d2ef278aa04f0ad01d6cdc", 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.OperationContract = armapimanagement.OperationContract{ - // Name: to.Ptr("57d2ef278aa04f0ad01d6cdc"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/operations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d2ef278aa04f0888cba3f3/operations/57d2ef278aa04f0ad01d6cdc"), - // Properties: &armapimanagement.OperationContractProperties{ - // TemplateParameters: []*armapimanagement.ParameterContract{ - // }, - // Request: &armapimanagement.RequestContract{ - // Description: to.Ptr("IFazioService_CancelOrder_InputMessage"), - // Headers: []*armapimanagement.ParameterContract{ - // }, - // QueryParameters: []*armapimanagement.ParameterContract{ - // }, - // Representations: []*armapimanagement.RepresentationContract{ - // { - // ContentType: to.Ptr("text/xml"), - // SchemaID: to.Ptr("6980a395-f08b-4a59-8295-1440cbd909b8"), - // TypeName: to.Ptr("CancelOrder"), - // }}, - // }, - // Responses: []*armapimanagement.ResponseContract{ - // { - // Description: to.Ptr("IFazioService_CancelOrder_OutputMessage"), - // Headers: []*armapimanagement.ParameterContract{ - // }, - // Representations: []*armapimanagement.RepresentationContract{ - // { - // ContentType: to.Ptr("text/xml"), - // SchemaID: to.Ptr("6980a395-f08b-4a59-8295-1440cbd909b8"), - // TypeName: to.Ptr("CancelOrderResponse"), - // }}, - // StatusCode: to.Ptr[int32](200), - // }}, - // Method: to.Ptr("POST"), - // DisplayName: to.Ptr("CancelOrder"), - // URLTemplate: to.Ptr("/?soapAction=http://tempuri.org/IFazioService/CancelOrder"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationPetStore.json -func ExampleAPIOperationClient_Get_apiManagementGetApiOperationPetStore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIOperationClient().Get(ctx, "rg1", "apimService1", "swagger-petstore", "loginUser", 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.OperationContract = armapimanagement.OperationContract{ - // Name: to.Ptr("loginUser"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/operations"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/swagger-petstore/operations/loginUser"), - // Properties: &armapimanagement.OperationContractProperties{ - // Description: to.Ptr(""), - // TemplateParameters: []*armapimanagement.ParameterContract{ - // { - // Name: to.Ptr("username"), - // Type: to.Ptr("string"), - // Description: to.Ptr("The user name for login"), - // Required: to.Ptr(true), - // Values: []*string{ - // }, - // }, - // { - // Name: to.Ptr("password"), - // Type: to.Ptr("string"), - // Description: to.Ptr("The password for login in clear text"), - // Required: to.Ptr(true), - // Values: []*string{ - // }, - // }}, - // Request: &armapimanagement.RequestContract{ - // Headers: []*armapimanagement.ParameterContract{ - // }, - // QueryParameters: []*armapimanagement.ParameterContract{ - // }, - // Representations: []*armapimanagement.RepresentationContract{ - // }, - // }, - // Responses: []*armapimanagement.ResponseContract{ - // { - // Description: to.Ptr("successful operation"), - // Headers: []*armapimanagement.ParameterContract{ - // { - // Name: to.Ptr("X-Rate-Limit"), - // Type: to.Ptr("integer"), - // Description: to.Ptr("calls per hour allowed by the user"), - // Values: []*string{ - // }, - // }, - // { - // Name: to.Ptr("X-Expires-After"), - // Type: to.Ptr("string"), - // Description: to.Ptr("date in UTC when token expires"), - // Values: []*string{ - // }, - // }}, - // Representations: []*armapimanagement.RepresentationContract{ - // { - // ContentType: to.Ptr("application/xml"), - // SchemaID: to.Ptr("5ba91a35f373b513a0bf31c6"), - // TypeName: to.Ptr("UserLoginGet200ApplicationXmlResponse"), - // }, - // { - // ContentType: to.Ptr("application/json"), - // SchemaID: to.Ptr("5ba91a35f373b513a0bf31c6"), - // TypeName: to.Ptr("UserLoginGet200ApplicationJsonResponse"), - // }}, - // StatusCode: to.Ptr[int32](200), - // }, - // { - // Description: to.Ptr("Invalid username/password supplied"), - // Headers: []*armapimanagement.ParameterContract{ - // }, - // Representations: []*armapimanagement.RepresentationContract{ - // { - // ContentType: to.Ptr("application/xml"), - // }, - // { - // ContentType: to.Ptr("application/json"), - // }}, - // StatusCode: to.Ptr[int32](400), - // }}, - // Method: to.Ptr("GET"), - // DisplayName: to.Ptr("Logs user into the system"), - // URLTemplate: to.Ptr("/user/login?username={username}&password={password}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiOperation.json -func ExampleAPIOperationClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIOperationClient().CreateOrUpdate(ctx, "rg1", "apimService1", "PetStoreTemplate2", "newoperations", armapimanagement.OperationContract{ - Properties: &armapimanagement.OperationContractProperties{ - Description: to.Ptr("This can only be done by the logged in user."), - TemplateParameters: []*armapimanagement.ParameterContract{}, - Request: &armapimanagement.RequestContract{ - Description: to.Ptr("Created user object"), - Headers: []*armapimanagement.ParameterContract{}, - QueryParameters: []*armapimanagement.ParameterContract{}, - Representations: []*armapimanagement.RepresentationContract{ - { - ContentType: to.Ptr("application/json"), - SchemaID: to.Ptr("592f6c1d0af5840ca8897f0c"), - TypeName: to.Ptr("User"), - }}, - }, - Responses: []*armapimanagement.ResponseContract{ - { - Description: to.Ptr("successful operation"), - Headers: []*armapimanagement.ParameterContract{}, - Representations: []*armapimanagement.RepresentationContract{ - { - ContentType: to.Ptr("application/xml"), - }, - { - ContentType: to.Ptr("application/json"), - }}, - StatusCode: to.Ptr[int32](200), - }}, - Method: to.Ptr("POST"), - DisplayName: to.Ptr("createUser2"), - URLTemplate: to.Ptr("/user1"), - }, - }, &armapimanagement.APIOperationClientCreateOrUpdateOptions{IfMatch: 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.OperationContract = armapimanagement.OperationContract{ - // Name: to.Ptr("newoperations"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/operations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/PetStoreTemplate2/operations/newoperations"), - // Properties: &armapimanagement.OperationContractProperties{ - // Description: to.Ptr("This can only be done by the logged in user."), - // TemplateParameters: []*armapimanagement.ParameterContract{ - // }, - // Request: &armapimanagement.RequestContract{ - // Description: to.Ptr("Created user object"), - // Headers: []*armapimanagement.ParameterContract{ - // }, - // QueryParameters: []*armapimanagement.ParameterContract{ - // }, - // Representations: []*armapimanagement.RepresentationContract{ - // { - // ContentType: to.Ptr("application/json"), - // SchemaID: to.Ptr("592f6c1d0af5840ca8897f0c"), - // TypeName: to.Ptr("User"), - // }}, - // }, - // Responses: []*armapimanagement.ResponseContract{ - // { - // Description: to.Ptr("successful operation"), - // Headers: []*armapimanagement.ParameterContract{ - // }, - // Representations: []*armapimanagement.RepresentationContract{ - // { - // ContentType: to.Ptr("application/xml"), - // }, - // { - // ContentType: to.Ptr("application/json"), - // }}, - // StatusCode: to.Ptr[int32](200), - // }}, - // Method: to.Ptr("POST"), - // DisplayName: to.Ptr("createUser2"), - // URLTemplate: to.Ptr("/user1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiOperation.json -func ExampleAPIOperationClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIOperationClient().Update(ctx, "rg1", "apimService1", "echo-api", "operationId", "*", armapimanagement.OperationUpdateContract{ - Properties: &armapimanagement.OperationUpdateContractProperties{ - TemplateParameters: []*armapimanagement.ParameterContract{}, - Request: &armapimanagement.RequestContract{ - QueryParameters: []*armapimanagement.ParameterContract{ - { - Name: to.Ptr("param1"), - Type: to.Ptr("string"), - Description: to.Ptr("A sample parameter that is required and has a default value of \"sample\"."), - DefaultValue: to.Ptr("sample"), - Required: to.Ptr(true), - Values: []*string{ - to.Ptr("sample")}, - }}, - }, - Responses: []*armapimanagement.ResponseContract{ - { - Description: to.Ptr("Returned in all cases."), - Headers: []*armapimanagement.ParameterContract{}, - Representations: []*armapimanagement.RepresentationContract{}, - StatusCode: to.Ptr[int32](200), - }, - { - Description: to.Ptr("Server Error."), - Headers: []*armapimanagement.ParameterContract{}, - Representations: []*armapimanagement.RepresentationContract{}, - StatusCode: to.Ptr[int32](500), - }}, - Method: to.Ptr("GET"), - DisplayName: to.Ptr("Retrieve resource"), - URLTemplate: to.Ptr("/resource"), - }, - }, 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.OperationContract = armapimanagement.OperationContract{ - // Name: to.Ptr("57d2ef278aa04f0ad01d6cdc"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/operations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d2ef278aa04f0888cba3f3/operations/57d2ef278aa04f0ad01d6cdc"), - // Properties: &armapimanagement.OperationContractProperties{ - // TemplateParameters: []*armapimanagement.ParameterContract{ - // }, - // Request: &armapimanagement.RequestContract{ - // Description: to.Ptr("IFazioService_CancelOrder_InputMessage"), - // Headers: []*armapimanagement.ParameterContract{ - // }, - // QueryParameters: []*armapimanagement.ParameterContract{ - // }, - // Representations: []*armapimanagement.RepresentationContract{ - // { - // ContentType: to.Ptr("text/xml"), - // SchemaID: to.Ptr("6980a395-f08b-4a59-8295-1440cbd909b8"), - // TypeName: to.Ptr("CancelOrder"), - // }}, - // }, - // Responses: []*armapimanagement.ResponseContract{ - // { - // Description: to.Ptr("IFazioService_CancelOrder_OutputMessage"), - // Headers: []*armapimanagement.ParameterContract{ - // }, - // Representations: []*armapimanagement.RepresentationContract{ - // { - // ContentType: to.Ptr("text/xml"), - // SchemaID: to.Ptr("6980a395-f08b-4a59-8295-1440cbd909b8"), - // TypeName: to.Ptr("CancelOrderResponse"), - // }}, - // StatusCode: to.Ptr[int32](200), - // }}, - // Method: to.Ptr("POST"), - // DisplayName: to.Ptr("CancelOrder"), - // URLTemplate: to.Ptr("/?soapAction=http://tempuri.org/IFazioService/CancelOrder"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiOperation.json -func ExampleAPIOperationClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIOperationClient().Delete(ctx, "rg1", "apimService1", "57d2ef278aa04f0888cba3f3", "57d2ef278aa04f0ad01d6cdc", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apioperationpolicy_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apioperationpolicy_client.go index bb0e0632fec0..e19fdbb1b380 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apioperationpolicy_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apioperationpolicy_client.go @@ -29,8 +29,7 @@ type APIOperationPolicyClient struct { } // NewAPIOperationPolicyClient creates a new instance of APIOperationPolicyClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPIOperationPolicyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIOperationPolicyClient, error) { @@ -48,8 +47,8 @@ func NewAPIOperationPolicyClient(subscriptionID string, credential azcore.TokenC // CreateOrUpdate - Creates or updates policy configuration for the API Operation level. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -105,7 +104,7 @@ func (client *APIOperationPolicyClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -129,8 +128,8 @@ func (client *APIOperationPolicyClient) createOrUpdateHandleResponse(resp *http. // Delete - Deletes the policy configuration at the Api Operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -187,7 +186,7 @@ func (client *APIOperationPolicyClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -197,8 +196,8 @@ func (client *APIOperationPolicyClient) deleteCreateRequest(ctx context.Context, // Get - Get the policy configuration at the API Operation level. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -255,7 +254,7 @@ func (client *APIOperationPolicyClient) getCreateRequest(ctx context.Context, re if options != nil && options.Format != nil { reqQP.Set("format", string(*options.Format)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -275,8 +274,8 @@ func (client *APIOperationPolicyClient) getHandleResponse(resp *http.Response) ( // GetEntityTag - Gets the entity state (Etag) version of the API operation policy specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -331,7 +330,7 @@ func (client *APIOperationPolicyClient) getEntityTagCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -350,8 +349,8 @@ func (client *APIOperationPolicyClient) getEntityTagHandleResponse(resp *http.Re // ListByOperation - Get the list of policy configuration at the API Operation level. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -401,7 +400,7 @@ func (client *APIOperationPolicyClient) listByOperationCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apioperationpolicy_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/apioperationpolicy_client_example_test.go deleted file mode 100644 index 2d09988fc1e3..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apioperationpolicy_client_example_test.go +++ /dev/null @@ -1,146 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiOperationPolicies.json -func ExampleAPIOperationPolicyClient_ListByOperation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIOperationPolicyClient().ListByOperation(ctx, "rg1", "apimService1", "599e2953193c3c0bd0b3e2fa", "599e29ab193c3c0bd0b3e2fb", 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.PolicyCollection = armapimanagement.PolicyCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.PolicyContract{ - // { - // Name: to.Ptr("policy"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/operations/policies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/599e2953193c3c0bd0b3e2fa/operations/599e29ab193c3c0bd0b3e2fb/policies/policy"), - // Properties: &armapimanagement.PolicyContractProperties{ - // Value: to.Ptr("\r\n\r\n \r\n \r\n \r\n \r\n xxx\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiOperationPolicy.json -func ExampleAPIOperationPolicyClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIOperationPolicyClient().GetEntityTag(ctx, "rg1", "apimService1", "5600b539c53f5b0062040001", "5600b53ac53f5b0062080006", armapimanagement.PolicyIDNamePolicy, 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationPolicy.json -func ExampleAPIOperationPolicyClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIOperationPolicyClient().Get(ctx, "rg1", "apimService1", "5600b539c53f5b0062040001", "5600b53ac53f5b0062080006", armapimanagement.PolicyIDNamePolicy, &armapimanagement.APIOperationPolicyClientGetOptions{Format: 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.PolicyContract = armapimanagement.PolicyContract{ - // Name: to.Ptr("policy"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/operations/policies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/5600b539c53f5b0062040001/operations/5600b53ac53f5b0062080006/policies/policy"), - // Properties: &armapimanagement.PolicyContractProperties{ - // Value: to.Ptr("\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n This is a sample\r\n \r\n \r\n \r\n \r\n"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiOperationPolicy.json -func ExampleAPIOperationPolicyClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIOperationPolicyClient().CreateOrUpdate(ctx, "rg1", "apimService1", "5600b57e7e8880006a040001", "5600b57e7e8880006a080001", armapimanagement.PolicyIDNamePolicy, armapimanagement.PolicyContract{ - Properties: &armapimanagement.PolicyContractProperties{ - Format: to.Ptr(armapimanagement.PolicyContentFormatXML), - Value: to.Ptr(" "), - }, - }, &armapimanagement.APIOperationPolicyClientCreateOrUpdateOptions{IfMatch: to.Ptr("*")}) - 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.PolicyContract = armapimanagement.PolicyContract{ - // Name: to.Ptr("policy"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/operations/policies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/5600b57e7e8880006a040001/operations/5600b57e7e8880006a080001/policies/policy"), - // Properties: &armapimanagement.PolicyContractProperties{ - // Value: to.Ptr("\r\n \r\n \r\n \r\n \r\n \r\n"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiOperationPolicy.json -func ExampleAPIOperationPolicyClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIOperationPolicyClient().Delete(ctx, "rg1", "apimService1", "testapi", "testoperation", armapimanagement.PolicyIDNamePolicy, "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apipolicy_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apipolicy_client.go index 888960d0749c..17550dd1ce75 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apipolicy_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apipolicy_client.go @@ -29,8 +29,7 @@ type APIPolicyClient struct { } // NewAPIPolicyClient creates a new instance of APIPolicyClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPIPolicyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIPolicyClient, error) { @@ -48,8 +47,8 @@ func NewAPIPolicyClient(subscriptionID string, credential azcore.TokenCredential // CreateOrUpdate - Creates or updates policy configuration for the API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -100,7 +99,7 @@ func (client *APIPolicyClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -124,8 +123,8 @@ func (client *APIPolicyClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Deletes the policy configuration at the Api. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -176,7 +175,7 @@ func (client *APIPolicyClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -186,8 +185,8 @@ func (client *APIPolicyClient) deleteCreateRequest(ctx context.Context, resource // Get - Get the policy configuration at the API level. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -239,7 +238,7 @@ func (client *APIPolicyClient) getCreateRequest(ctx context.Context, resourceGro if options != nil && options.Format != nil { reqQP.Set("format", string(*options.Format)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, application/vnd.ms-azure-apim.policy+xml, application/vnd.ms-azure-apim.policy.raw+xml"} return req, nil @@ -259,8 +258,8 @@ func (client *APIPolicyClient) getHandleResponse(resp *http.Response) (APIPolicy // GetEntityTag - Gets the entity state (Etag) version of the API policy specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -309,7 +308,7 @@ func (client *APIPolicyClient) getEntityTagCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -328,8 +327,8 @@ func (client *APIPolicyClient) getEntityTagHandleResponse(resp *http.Response) ( // ListByAPI - Get the policy configuration at the API level. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -373,7 +372,7 @@ func (client *APIPolicyClient) listByAPICreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apipolicy_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/apipolicy_client_example_test.go deleted file mode 100644 index 4f9ef6cd584e..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apipolicy_client_example_test.go +++ /dev/null @@ -1,179 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiPolicies.json -func ExampleAPIPolicyClient_ListByAPI() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIPolicyClient().ListByAPI(ctx, "rg1", "apimService1", "5600b59475ff190048040001", 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.PolicyCollection = armapimanagement.PolicyCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.PolicyContract{ - // { - // Name: to.Ptr("policy"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/policies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/5600b59475ff190048040001/policies/policy"), - // Properties: &armapimanagement.PolicyContractProperties{ - // Value: to.Ptr("\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n@{\r\n Random Random = new Random();\r\n const string Chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz \"; \r\n return string.Join(\",\", DateTime.UtcNow, new string(\r\n Enumerable.Repeat(Chars, Random.Next(2150400))\r\n .Select(s => s[Random.Next(s.Length)])\r\n .ToArray()));\r\n } \r\n \r\n \r\n \r\n"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiPolicy.json -func ExampleAPIPolicyClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIPolicyClient().GetEntityTag(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", armapimanagement.PolicyIDNamePolicy, 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiPolicy.json -func ExampleAPIPolicyClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIPolicyClient().Get(ctx, "rg1", "apimService1", "5600b59475ff190048040001", armapimanagement.PolicyIDNamePolicy, &armapimanagement.APIPolicyClientGetOptions{Format: 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.PolicyContract = armapimanagement.PolicyContract{ - // Name: to.Ptr("policy"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/policies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/5600b59475ff190048040001/policies/policy"), - // Properties: &armapimanagement.PolicyContractProperties{ - // Value: to.Ptr("\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n@{\r\n Random Random = new Random();\r\n const string Chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz \"; \r\n return string.Join(\",\", DateTime.UtcNow, new string(\r\n Enumerable.Repeat(Chars, Random.Next(2150400))\r\n .Select(s => s[Random.Next(s.Length)])\r\n .ToArray()));\r\n } \r\n \r\n \r\n \r\n"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiPolicy.json -func ExampleAPIPolicyClient_CreateOrUpdate_apiManagementCreateApiPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIPolicyClient().CreateOrUpdate(ctx, "rg1", "apimService1", "5600b57e7e8880006a040001", armapimanagement.PolicyIDNamePolicy, armapimanagement.PolicyContract{ - Properties: &armapimanagement.PolicyContractProperties{ - Format: to.Ptr(armapimanagement.PolicyContentFormatXML), - Value: to.Ptr(" "), - }, - }, &armapimanagement.APIPolicyClientCreateOrUpdateOptions{IfMatch: to.Ptr("*")}) - 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.PolicyContract = armapimanagement.PolicyContract{ - // Name: to.Ptr("policy"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/policies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/5600b57e7e8880006a040001/policies/policy"), - // Properties: &armapimanagement.PolicyContractProperties{ - // Value: to.Ptr("\r\n \r\n \r\n \r\n \r\n \r\n"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiPolicyNonXmlEncoded.json -func ExampleAPIPolicyClient_CreateOrUpdate_apiManagementCreateApiPolicyNonXmlEncoded() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIPolicyClient().CreateOrUpdate(ctx, "rg1", "apimService1", "5600b57e7e8880006a040001", armapimanagement.PolicyIDNamePolicy, armapimanagement.PolicyContract{ - Properties: &armapimanagement.PolicyContractProperties{ - Format: to.Ptr(armapimanagement.PolicyContentFormatRawxml), - Value: to.Ptr("\r\n \r\n \r\n \r\n \"@(context.Request.Headers.FirstOrDefault(h => h.Ke==\"Via\"))\" \r\n \r\n \r\n "), - }, - }, &armapimanagement.APIPolicyClientCreateOrUpdateOptions{IfMatch: to.Ptr("*")}) - 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.PolicyContract = armapimanagement.PolicyContract{ - // Name: to.Ptr("policy"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/operations/policies"), - // ID: to.Ptr("/subscriptions/4c1a3bc6-89f9-46fe-a175-5d8984b25095/resourcegroups/Api-DF-West-US/providers/Microsoft.ApiManagement/service/samirmsiservice2/apis/echo-api/operations/create-resource/policies/policy"), - // Properties: &armapimanagement.PolicyContractProperties{ - // Value: to.Ptr("\r\n \r\n \r\n \r\n \"@(context.Request.Headers.FirstOrDefault(h => h.Ke==\"Via\"))\" \r\n \r\n \r\n"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiPolicy.json -func ExampleAPIPolicyClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIPolicyClient().Delete(ctx, "rg1", "apimService1", "loggerId", armapimanagement.PolicyIDNamePolicy, "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apiproduct_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apiproduct_client.go index d4803af90cbf..625af95fc5b7 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apiproduct_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apiproduct_client.go @@ -30,8 +30,7 @@ type APIProductClient struct { } // NewAPIProductClient creates a new instance of APIProductClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPIProductClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIProductClient, error) { @@ -48,8 +47,8 @@ func NewAPIProductClient(subscriptionID string, credential azcore.TokenCredentia // NewListByApisPager - Lists all Products, which the API is part of. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - options - APIProductClientListByApisOptions contains the optional parameters for the APIProductClient.NewListByApisPager @@ -115,7 +114,7 @@ func (client *APIProductClient) listByApisCreateRequest(ctx context.Context, res if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apiproduct_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/apiproduct_client_example_test.go deleted file mode 100644 index 0e0d99442a66..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apiproduct_client_example_test.go +++ /dev/null @@ -1,63 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiProducts.json -func ExampleAPIProductClient_NewListByApisPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIProductClient().NewListByApisPager("rg1", "apimService1", "57d2ef278aa04f0888cba3f3", &armapimanagement.APIProductClientListByApisOptions{Filter: nil, - Top: nil, - Skip: 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.ProductCollection = armapimanagement.ProductCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.ProductContract{ - // { - // Name: to.Ptr("5600b539c53f5b0062060002"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/products"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b539c53f5b0062060002"), - // Properties: &armapimanagement.ProductContractProperties{ - // Description: to.Ptr("Subscribers have completely unlimited access to the API. Administrator approval is required."), - // ApprovalRequired: to.Ptr(true), - // State: to.Ptr(armapimanagement.ProductStatePublished), - // SubscriptionRequired: to.Ptr(true), - // SubscriptionsLimit: to.Ptr[int32](1), - // DisplayName: to.Ptr("Unlimited"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apirelease_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apirelease_client.go index 4883f1b10498..99c2227c0632 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apirelease_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apirelease_client.go @@ -30,8 +30,7 @@ type APIReleaseClient struct { } // NewAPIReleaseClient creates a new instance of APIReleaseClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPIReleaseClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIReleaseClient, error) { @@ -49,8 +48,8 @@ func NewAPIReleaseClient(subscriptionID string, credential azcore.TokenCredentia // CreateOrUpdate - Creates a new Release for the API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - releaseID - Release identifier within an API. Must be unique in the current API Management service instance. @@ -100,7 +99,7 @@ func (client *APIReleaseClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -124,8 +123,8 @@ func (client *APIReleaseClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Deletes the specified release in the API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - releaseID - Release identifier within an API. Must be unique in the current API Management service instance. @@ -175,7 +174,7 @@ func (client *APIReleaseClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -185,8 +184,8 @@ func (client *APIReleaseClient) deleteCreateRequest(ctx context.Context, resourc // Get - Returns the details of an API release. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - releaseID - Release identifier within an API. Must be unique in the current API Management service instance. @@ -234,7 +233,7 @@ func (client *APIReleaseClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,8 +253,8 @@ func (client *APIReleaseClient) getHandleResponse(resp *http.Response) (APIRelea // GetEntityTag - Returns the etag of an API release. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - releaseID - Release identifier within an API. Must be unique in the current API Management service instance. @@ -303,7 +302,7 @@ func (client *APIReleaseClient) getEntityTagCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -323,8 +322,8 @@ func (client *APIReleaseClient) getEntityTagHandleResponse(resp *http.Response) // are also used to rollback to previous revisions. Results will be paged and can be constrained by // the $top and $skip parameters. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - options - APIReleaseClientListByServiceOptions contains the optional parameters for the APIReleaseClient.NewListByServicePager @@ -390,7 +389,7 @@ func (client *APIReleaseClient) listByServiceCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -408,8 +407,8 @@ func (client *APIReleaseClient) listByServiceHandleResponse(resp *http.Response) // Update - Updates the details of the release of the API specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - releaseID - Release identifier within an API. Must be unique in the current API Management service instance. @@ -460,7 +459,7 @@ func (client *APIReleaseClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apirelease_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/apirelease_client_example_test.go deleted file mode 100644 index f0cac561f217..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apirelease_client_example_test.go +++ /dev/null @@ -1,198 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiReleases.json -func ExampleAPIReleaseClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIReleaseClient().NewListByServicePager("rg1", "apimService1", "a1", &armapimanagement.APIReleaseClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.APIReleaseCollection = armapimanagement.APIReleaseCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.APIReleaseContract{ - // { - // Name: to.Ptr("5a7cb545298324c53224a799"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/releases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1/releases/5a7cb545298324c53224a799"), - // Properties: &armapimanagement.APIReleaseContractProperties{ - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-08T20:38:29.173Z"); return t}()), - // Notes: to.Ptr("yahoo"), - // UpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-08T20:38:29.173Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiRelease.json -func ExampleAPIReleaseClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIReleaseClient().GetEntityTag(ctx, "rg1", "apimService1", "a1", "5a7cb545298324c53224a799", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRelease.json -func ExampleAPIReleaseClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIReleaseClient().Get(ctx, "rg1", "apimService1", "a1", "5a7cb545298324c53224a799", 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.APIReleaseContract = armapimanagement.APIReleaseContract{ - // Name: to.Ptr("5a7cb545298324c53224a799"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/releases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1/releases/5a7cb545298324c53224a799"), - // Properties: &armapimanagement.APIReleaseContractProperties{ - // APIID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1"), - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-08T20:38:29.173Z"); return t}()), - // Notes: to.Ptr("yahoo"), - // UpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-08T20:38:29.173Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiRelease.json -func ExampleAPIReleaseClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIReleaseClient().CreateOrUpdate(ctx, "rg1", "apimService1", "a1", "testrev", armapimanagement.APIReleaseContract{ - Properties: &armapimanagement.APIReleaseContractProperties{ - APIID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1"), - Notes: to.Ptr("yahooagain"), - }, - }, &armapimanagement.APIReleaseClientCreateOrUpdateOptions{IfMatch: 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.APIReleaseContract = armapimanagement.APIReleaseContract{ - // Name: to.Ptr("testrev"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/releases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1/releases/testrev"), - // Properties: &armapimanagement.APIReleaseContractProperties{ - // APIID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1"), - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-08T20:52:00.65Z"); return t}()), - // Notes: to.Ptr("yahooagain"), - // UpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-08T20:52:00.65Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiRelease.json -func ExampleAPIReleaseClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIReleaseClient().Update(ctx, "rg1", "apimService1", "a1", "testrev", "*", armapimanagement.APIReleaseContract{ - Properties: &armapimanagement.APIReleaseContractProperties{ - APIID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1"), - Notes: to.Ptr("yahooagain"), - }, - }, 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.APIReleaseContract = armapimanagement.APIReleaseContract{ - // Name: to.Ptr("testrev"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/releases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1/releases/testrev"), - // Properties: &armapimanagement.APIReleaseContractProperties{ - // APIID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1"), - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-08T20:38:29.173Z"); return t}()), - // Notes: to.Ptr("yahoo"), - // UpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-08T20:38:29.173Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiRelease.json -func ExampleAPIReleaseClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIReleaseClient().Delete(ctx, "rg1", "apimService1", "5a5fcc09124a7fa9b89f2f1d", "testrev", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apirevision_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apirevision_client.go index bf57ea25d919..e80308222663 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apirevision_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apirevision_client.go @@ -30,8 +30,7 @@ type APIRevisionClient struct { } // NewAPIRevisionClient creates a new instance of APIRevisionClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPIRevisionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIRevisionClient, error) { @@ -48,8 +47,8 @@ func NewAPIRevisionClient(subscriptionID string, credential azcore.TokenCredenti // NewListByServicePager - Lists all revisions of an API. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API identifier. Must be unique in the current API Management service instance. // - options - APIRevisionClientListByServiceOptions contains the optional parameters for the APIRevisionClient.NewListByServicePager @@ -115,7 +114,7 @@ func (client *APIRevisionClient) listByServiceCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apirevision_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/apirevision_client_example_test.go deleted file mode 100644 index a8f73faa283a..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apirevision_client_example_test.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiRevisions.json -func ExampleAPIRevisionClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIRevisionClient().NewListByServicePager("rg1", "apimService1", "57d2ef278aa04f0888cba3f3", &armapimanagement.APIRevisionClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.APIRevisionCollection = armapimanagement.APIRevisionCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.APIRevisionContract{ - // { - // APIID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1;rev=1"), - // APIRevision: to.Ptr("1"), - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-01T22:21:20.467Z"); return t}()), - // IsCurrent: to.Ptr(true), - // IsOnline: to.Ptr(true), - // UpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-01T22:21:20.467Z"); return t}()), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apischema_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apischema_client.go index f6c887cce3b5..5b5ca14ffa20 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apischema_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apischema_client.go @@ -30,8 +30,7 @@ type APISchemaClient struct { } // NewAPISchemaClient creates a new instance of APISchemaClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPISchemaClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APISchemaClient, error) { @@ -49,8 +48,8 @@ func NewAPISchemaClient(subscriptionID string, credential azcore.TokenCredential // BeginCreateOrUpdate - Creates or updates schema configuration for the API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -75,7 +74,7 @@ func (client *APISchemaClient) BeginCreateOrUpdate(ctx context.Context, resource // CreateOrUpdate - Creates or updates schema configuration for the API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *APISchemaClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiID string, schemaID string, parameters SchemaContract, options *APISchemaClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, apiID, schemaID, parameters, options) if err != nil { @@ -119,7 +118,7 @@ func (client *APISchemaClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -131,8 +130,8 @@ func (client *APISchemaClient) createOrUpdateCreateRequest(ctx context.Context, // Delete - Deletes the schema configuration at the Api. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -186,7 +185,7 @@ func (client *APISchemaClient) deleteCreateRequest(ctx context.Context, resource if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -196,8 +195,8 @@ func (client *APISchemaClient) deleteCreateRequest(ctx context.Context, resource // Get - Get the schema configuration at the API level. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -246,7 +245,7 @@ func (client *APISchemaClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,8 +265,8 @@ func (client *APISchemaClient) getHandleResponse(resp *http.Response) (APISchema // GetEntityTag - Gets the entity state (Etag) version of the schema specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -316,7 +315,7 @@ func (client *APISchemaClient) getEntityTagCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -334,8 +333,8 @@ func (client *APISchemaClient) getEntityTagHandleResponse(resp *http.Response) ( // NewListByAPIPager - Get the schema configuration at the API level. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -401,7 +400,7 @@ func (client *APISchemaClient) listByAPICreateRequest(ctx context.Context, resou if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apischema_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/apischema_client_example_test.go deleted file mode 100644 index 58dff8d617da..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apischema_client_example_test.go +++ /dev/null @@ -1,166 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiSchemas.json -func ExampleAPISchemaClient_NewListByAPIPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPISchemaClient().NewListByAPIPager("rg1", "apimService1", "59d5b28d1f7fab116c282650", &armapimanagement.APISchemaClientListByAPIOptions{Filter: nil, - Top: nil, - Skip: 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.SchemaCollection = armapimanagement.SchemaCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.SchemaContract{ - // { - // Name: to.Ptr("59d5b28e1f7fab116402044e"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/schemas"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/59d5b28d1f7fab116c282650/schemas/59d5b28e1f7fab116402044e"), - // Properties: &armapimanagement.SchemaContractProperties{ - // ContentType: to.Ptr("application/vnd.ms-azure-apim.swagger.definitions+json"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiSchema.json -func ExampleAPISchemaClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPISchemaClient().GetEntityTag(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", "ec12520d-9d48-4e7b-8f39-698ca2ac63f1", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiSchema.json -func ExampleAPISchemaClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPISchemaClient().Get(ctx, "rg1", "apimService1", "59d6bb8f1f7fab13dc67ec9b", "ec12520d-9d48-4e7b-8f39-698ca2ac63f1", 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.SchemaContract = armapimanagement.SchemaContract{ - // Name: to.Ptr("ec12520d-9d48-4e7b-8f39-698ca2ac63f1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/schemas"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/59d6bb8f1f7fab13dc67ec9b/schemas/ec12520d-9d48-4e7b-8f39-698ca2ac63f1"), - // Properties: &armapimanagement.SchemaContractProperties{ - // ContentType: to.Ptr("application/vnd.ms-azure-apim.xsd+xml"), - // Document: &armapimanagement.SchemaDocumentProperties{ - // Value: to.Ptr("\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiSchema.json -func ExampleAPISchemaClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPISchemaClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "59d6bb8f1f7fab13dc67ec9b", "ec12520d-9d48-4e7b-8f39-698ca2ac63f1", armapimanagement.SchemaContract{ - Properties: &armapimanagement.SchemaContractProperties{ - ContentType: to.Ptr("application/vnd.ms-azure-apim.xsd+xml"), - Document: &armapimanagement.SchemaDocumentProperties{ - Value: to.Ptr("\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"), - }, - }, - }, &armapimanagement.APISchemaClientBeginCreateOrUpdateOptions{IfMatch: 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.SchemaContract = armapimanagement.SchemaContract{ - // Name: to.Ptr("ec12520d-9d48-4e7b-8f39-698ca2ac63f1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/schemas"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/59d6bb8f1f7fab13dc67ec9b/schemas/ec12520d-9d48-4e7b-8f39-698ca2ac63f1"), - // Properties: &armapimanagement.SchemaContractProperties{ - // ContentType: to.Ptr("application/vnd.ms-azure-apim.xsd+xml"), - // Document: &armapimanagement.SchemaDocumentProperties{ - // Value: to.Ptr("\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiSchema.json -func ExampleAPISchemaClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPISchemaClient().Delete(ctx, "rg1", "apimService1", "59d5b28d1f7fab116c282650", "59d5b28e1f7fab116402044e", "*", &armapimanagement.APISchemaClientDeleteOptions{Force: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apitagdescription_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apitagdescription_client.go index 862770e2d54c..cc99e7d6d8ef 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apitagdescription_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apitagdescription_client.go @@ -30,8 +30,7 @@ type APITagDescriptionClient struct { } // NewAPITagDescriptionClient creates a new instance of APITagDescriptionClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPITagDescriptionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APITagDescriptionClient, error) { @@ -49,8 +48,8 @@ func NewAPITagDescriptionClient(subscriptionID string, credential azcore.TokenCr // CreateOrUpdate - Create/Update tag description in scope of the Api. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -102,7 +101,7 @@ func (client *APITagDescriptionClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -126,8 +125,8 @@ func (client *APITagDescriptionClient) createOrUpdateHandleResponse(resp *http.R // Delete - Delete tag description for the Api. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -180,7 +179,7 @@ func (client *APITagDescriptionClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -190,8 +189,8 @@ func (client *APITagDescriptionClient) deleteCreateRequest(ctx context.Context, // Get - Get Tag description in scope of API // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -241,7 +240,7 @@ func (client *APITagDescriptionClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,8 +260,8 @@ func (client *APITagDescriptionClient) getHandleResponse(resp *http.Response) (A // GetEntityTag - Gets the entity state version of the tag specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -313,7 +312,7 @@ func (client *APITagDescriptionClient) getEntityTagCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -332,8 +331,8 @@ func (client *APITagDescriptionClient) getEntityTagHandleResponse(resp *http.Res // NewListByServicePager - Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined // on API level but tag may be assigned to the Operations // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -400,7 +399,7 @@ func (client *APITagDescriptionClient) listByServiceCreateRequest(ctx context.Co if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apitagdescription_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/apitagdescription_client_example_test.go deleted file mode 100644 index f3f8bb325bd9..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apitagdescription_client_example_test.go +++ /dev/null @@ -1,165 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiTagDescriptions.json -func ExampleAPITagDescriptionClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPITagDescriptionClient().NewListByServicePager("rg1", "apimService1", "57d2ef278aa04f0888cba3f3", &armapimanagement.APITagDescriptionClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.TagDescriptionCollection = armapimanagement.TagDescriptionCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.TagDescriptionContract{ - // { - // Name: to.Ptr("5600b539c53f5b0062060002"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tagDescriptions/5600b539c53f5b0062060002"), - // Properties: &armapimanagement.TagDescriptionContractProperties{ - // ExternalDocsDescription: to.Ptr("some additional info"), - // ExternalDocsURL: to.Ptr("http://some_url.com"), - // DisplayName: to.Ptr("tag1"), - // TagID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/5600b539c53f5b0062060002"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiTagDescription.json -func ExampleAPITagDescriptionClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPITagDescriptionClient().GetEntityTag(ctx, "rg1", "apimService1", "59d6bb8f1f7fab13dc67ec9b", "59306a29e4bbd510dc24e5f9", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiTagDescription.json -func ExampleAPITagDescriptionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPITagDescriptionClient().Get(ctx, "rg1", "apimService1", "59d6bb8f1f7fab13dc67ec9b", "59306a29e4bbd510dc24e5f9", 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.TagDescriptionContract = armapimanagement.TagDescriptionContract{ - // Name: to.Ptr("59306a29e4bbd510dc24e5f9"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/tagDescriptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/59d6bb8f1f7fab13dc67ec9b/tagDescriptions/59306a29e4bbd510dc24e5f9"), - // Properties: &armapimanagement.TagDescriptionContractProperties{ - // ExternalDocsDescription: to.Ptr("some additional info"), - // ExternalDocsURL: to.Ptr("http://some_url.com"), - // DisplayName: to.Ptr("tag1"), - // TagID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/59306a29e4bbd510dc24e5f9"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiTagDescription.json -func ExampleAPITagDescriptionClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPITagDescriptionClient().CreateOrUpdate(ctx, "rg1", "apimService1", "5931a75ae4bbd512a88c680b", "tagId1", armapimanagement.TagDescriptionCreateParameters{ - Properties: &armapimanagement.TagDescriptionBaseProperties{ - Description: to.Ptr("Some description that will be displayed for operation's tag if the tag is assigned to operation of the API"), - ExternalDocsDescription: to.Ptr("Description of the external docs resource"), - ExternalDocsURL: to.Ptr("http://some.url/additionaldoc"), - }, - }, &armapimanagement.APITagDescriptionClientCreateOrUpdateOptions{IfMatch: 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.TagDescriptionContract = armapimanagement.TagDescriptionContract{ - // Name: to.Ptr("tagId1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis/tagDescriptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/5931a75ae4bbd512a88c680b/tagDescriptions/tagId1"), - // Properties: &armapimanagement.TagDescriptionContractProperties{ - // Description: to.Ptr("Some description that will be displayed for operation's tag if the tag is assigned to operation of the API"), - // ExternalDocsDescription: to.Ptr("some additional info"), - // ExternalDocsURL: to.Ptr("http://some_url.com"), - // DisplayName: to.Ptr("tag1"), - // TagID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/tagId1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiTagDescription.json -func ExampleAPITagDescriptionClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPITagDescriptionClient().Delete(ctx, "rg1", "apimService1", "59d5b28d1f7fab116c282650", "59d5b28e1f7fab116402044e", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apiversionset_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apiversionset_client.go index a13705aa2047..a0466d60af70 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apiversionset_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apiversionset_client.go @@ -30,8 +30,7 @@ type APIVersionSetClient struct { } // NewAPIVersionSetClient creates a new instance of APIVersionSetClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPIVersionSetClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIVersionSetClient, error) { @@ -49,8 +48,8 @@ func NewAPIVersionSetClient(subscriptionID string, credential azcore.TokenCreden // CreateOrUpdate - Creates or Updates a Api Version Set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - versionSetID - Api Version Set identifier. Must be unique in the current API Management service instance. // - parameters - Create or update parameters. @@ -95,7 +94,7 @@ func (client *APIVersionSetClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -119,8 +118,8 @@ func (client *APIVersionSetClient) createOrUpdateHandleResponse(resp *http.Respo // Delete - Deletes specific Api Version Set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - versionSetID - Api Version Set identifier. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -165,7 +164,7 @@ func (client *APIVersionSetClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -175,8 +174,8 @@ func (client *APIVersionSetClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets the details of the Api Version Set specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - versionSetID - Api Version Set identifier. Must be unique in the current API Management service instance. // - options - APIVersionSetClientGetOptions contains the optional parameters for the APIVersionSetClient.Get method. @@ -219,7 +218,7 @@ func (client *APIVersionSetClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -239,8 +238,8 @@ func (client *APIVersionSetClient) getHandleResponse(resp *http.Response) (APIVe // GetEntityTag - Gets the entity state (Etag) version of the Api Version Set specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - versionSetID - Api Version Set identifier. Must be unique in the current API Management service instance. // - options - APIVersionSetClientGetEntityTagOptions contains the optional parameters for the APIVersionSetClient.GetEntityTag @@ -284,7 +283,7 @@ func (client *APIVersionSetClient) getEntityTagCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -302,8 +301,8 @@ func (client *APIVersionSetClient) getEntityTagHandleResponse(resp *http.Respons // NewListByServicePager - Lists a collection of API Version Sets in the specified service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - APIVersionSetClientListByServiceOptions contains the optional parameters for the APIVersionSetClient.NewListByServicePager // method. @@ -364,7 +363,7 @@ func (client *APIVersionSetClient) listByServiceCreateRequest(ctx context.Contex if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -382,8 +381,8 @@ func (client *APIVersionSetClient) listByServiceHandleResponse(resp *http.Respon // Update - Updates the details of the Api VersionSet specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - versionSetID - Api Version Set identifier. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -429,7 +428,7 @@ func (client *APIVersionSetClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apiversionset_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/apiversionset_client_example_test.go deleted file mode 100644 index 99049a34823a..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/apiversionset_client_example_test.go +++ /dev/null @@ -1,207 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiVersionSets.json -func ExampleAPIVersionSetClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIVersionSetClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.APIVersionSetClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.APIVersionSetCollection = armapimanagement.APIVersionSetCollection{ - // Count: to.Ptr[int64](2), - // Value: []*armapimanagement.APIVersionSetContract{ - // { - // Name: to.Ptr("vs1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/api-version-sets"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/vs1"), - // Properties: &armapimanagement.APIVersionSetContractProperties{ - // Description: to.Ptr("Version configuration"), - // DisplayName: to.Ptr("api set 1"), - // VersioningScheme: to.Ptr(armapimanagement.VersioningSchemeSegment), - // }, - // }, - // { - // Name: to.Ptr("vs2"), - // Type: to.Ptr("Microsoft.ApiManagement/service/api-version-sets"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/vs2"), - // Properties: &armapimanagement.APIVersionSetContractProperties{ - // Description: to.Ptr("Version configuration 2"), - // DisplayName: to.Ptr("api set 2"), - // VersioningScheme: to.Ptr(armapimanagement.VersioningSchemeQuery), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiVersionSet.json -func ExampleAPIVersionSetClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIVersionSetClient().GetEntityTag(ctx, "rg1", "apimService1", "vs1", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiVersionSet.json -func ExampleAPIVersionSetClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIVersionSetClient().Get(ctx, "rg1", "apimService1", "vs1", 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.APIVersionSetContract = armapimanagement.APIVersionSetContract{ - // Name: to.Ptr("vs1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/api-version-sets"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/vs1"), - // Properties: &armapimanagement.APIVersionSetContractProperties{ - // Description: to.Ptr("Version configuration"), - // DisplayName: to.Ptr("Version Set 1"), - // VersioningScheme: to.Ptr(armapimanagement.VersioningSchemeSegment), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiVersionSet.json -func ExampleAPIVersionSetClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIVersionSetClient().CreateOrUpdate(ctx, "rg1", "apimService1", "api1", armapimanagement.APIVersionSetContract{ - Properties: &armapimanagement.APIVersionSetContractProperties{ - Description: to.Ptr("Version configuration"), - DisplayName: to.Ptr("api set 1"), - VersioningScheme: to.Ptr(armapimanagement.VersioningSchemeSegment), - }, - }, &armapimanagement.APIVersionSetClientCreateOrUpdateOptions{IfMatch: 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.APIVersionSetContract = armapimanagement.APIVersionSetContract{ - // Name: to.Ptr("api1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/api-version-sets"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/api1"), - // Properties: &armapimanagement.APIVersionSetContractProperties{ - // Description: to.Ptr("Version configuration"), - // DisplayName: to.Ptr("api set 1"), - // VersioningScheme: to.Ptr(armapimanagement.VersioningSchemeSegment), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiVersionSet.json -func ExampleAPIVersionSetClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIVersionSetClient().Update(ctx, "rg1", "apimService1", "vs1", "*", armapimanagement.APIVersionSetUpdateParameters{ - Properties: &armapimanagement.APIVersionSetUpdateParametersProperties{ - Description: to.Ptr("Version configuration"), - DisplayName: to.Ptr("api set 1"), - VersioningScheme: to.Ptr(armapimanagement.VersioningSchemeSegment), - }, - }, 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.APIVersionSetContract = armapimanagement.APIVersionSetContract{ - // Name: to.Ptr("vs1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/api-version-sets"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/vs1"), - // Properties: &armapimanagement.APIVersionSetContractProperties{ - // Description: to.Ptr("Version configuration"), - // DisplayName: to.Ptr("api set 1"), - // VersioningScheme: to.Ptr(armapimanagement.VersioningSchemeSegment), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiVersionSet.json -func ExampleAPIVersionSetClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIVersionSetClient().Delete(ctx, "rg1", "apimService1", "a1", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apiwiki_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apiwiki_client.go new file mode 100644 index 000000000000..9ba994f914b5 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apiwiki_client.go @@ -0,0 +1,366 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// APIWikiClient contains the methods for the APIWiki group. +// Don't use this type directly, use NewAPIWikiClient() instead. +type APIWikiClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAPIWikiClient creates a new instance of APIWikiClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAPIWikiClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIWikiClient, error) { + cl, err := arm.NewClient(moduleName+".APIWikiClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &APIWikiClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates a new Wiki for an API or updates an existing one. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API identifier. Must be unique in the current API Management service instance. +// - parameters - Create parameters. +// - options - APIWikiClientCreateOrUpdateOptions contains the optional parameters for the APIWikiClient.CreateOrUpdate method. +func (client *APIWikiClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiID string, parameters WikiContract, options *APIWikiClientCreateOrUpdateOptions) (APIWikiClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, apiID, parameters, options) + if err != nil { + return APIWikiClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return APIWikiClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return APIWikiClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *APIWikiClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, parameters WikiContract, options *APIWikiClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *APIWikiClient) createOrUpdateHandleResponse(resp *http.Response) (APIWikiClientCreateOrUpdateResponse, error) { + result := APIWikiClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.WikiContract); err != nil { + return APIWikiClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified Wiki from an API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - APIWikiClientDeleteOptions contains the optional parameters for the APIWikiClient.Delete method. +func (client *APIWikiClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiID string, ifMatch string, options *APIWikiClientDeleteOptions) (APIWikiClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, apiID, ifMatch, options) + if err != nil { + return APIWikiClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return APIWikiClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return APIWikiClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return APIWikiClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *APIWikiClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, ifMatch string, options *APIWikiClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the Wiki for an API specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API identifier. Must be unique in the current API Management service instance. +// - options - APIWikiClientGetOptions contains the optional parameters for the APIWikiClient.Get method. +func (client *APIWikiClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *APIWikiClientGetOptions) (APIWikiClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, apiID, options) + if err != nil { + return APIWikiClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return APIWikiClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return APIWikiClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *APIWikiClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *APIWikiClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *APIWikiClient) getHandleResponse(resp *http.Response) (APIWikiClientGetResponse, error) { + result := APIWikiClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.WikiContract); err != nil { + return APIWikiClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the Wiki for an API specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API identifier. Must be unique in the current API Management service instance. +// - options - APIWikiClientGetEntityTagOptions contains the optional parameters for the APIWikiClient.GetEntityTag method. +func (client *APIWikiClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *APIWikiClientGetEntityTagOptions) (APIWikiClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, apiID, options) + if err != nil { + return APIWikiClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return APIWikiClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return APIWikiClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *APIWikiClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *APIWikiClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *APIWikiClient) getEntityTagHandleResponse(resp *http.Response) (APIWikiClientGetEntityTagResponse, error) { + result := APIWikiClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// Update - Updates the details of the Wiki for an API specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - Wiki Update parameters. +// - options - APIWikiClientUpdateOptions contains the optional parameters for the APIWikiClient.Update method. +func (client *APIWikiClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiID string, ifMatch string, parameters WikiUpdateContract, options *APIWikiClientUpdateOptions) (APIWikiClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, apiID, ifMatch, parameters, options) + if err != nil { + return APIWikiClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return APIWikiClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return APIWikiClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *APIWikiClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, ifMatch string, parameters WikiUpdateContract, options *APIWikiClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *APIWikiClient) updateHandleResponse(resp *http.Response) (APIWikiClientUpdateResponse, error) { + result := APIWikiClientUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.WikiContract); err != nil { + return APIWikiClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/apiwikis_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/apiwikis_client.go new file mode 100644 index 000000000000..13109f61f0a2 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/apiwikis_client.go @@ -0,0 +1,129 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// APIWikisClient contains the methods for the APIWikis group. +// Don't use this type directly, use NewAPIWikisClient() instead. +type APIWikisClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAPIWikisClient creates a new instance of APIWikisClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAPIWikisClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIWikisClient, error) { + cl, err := arm.NewClient(moduleName+".APIWikisClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &APIWikisClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets the wikis for an API specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API identifier. Must be unique in the current API Management service instance. +// - options - APIWikisClientListOptions contains the optional parameters for the APIWikisClient.NewListPager method. +func (client *APIWikisClient) NewListPager(resourceGroupName string, serviceName string, apiID string, options *APIWikisClientListOptions) *runtime.Pager[APIWikisClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[APIWikisClientListResponse]{ + More: func(page APIWikisClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *APIWikisClientListResponse) (APIWikisClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, serviceName, apiID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return APIWikisClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return APIWikisClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return APIWikisClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *APIWikisClient) listCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *APIWikisClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *APIWikisClient) listHandleResponse(resp *http.Response) (APIWikisClientListResponse, error) { + result := APIWikisClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WikiCollection); err != nil { + return APIWikisClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/authorization_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/authorization_client.go new file mode 100644 index 000000000000..890585750836 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/authorization_client.go @@ -0,0 +1,405 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// AuthorizationClient contains the methods for the Authorization group. +// Don't use this type directly, use NewAuthorizationClient() instead. +type AuthorizationClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAuthorizationClient creates a new instance of AuthorizationClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAuthorizationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AuthorizationClient, error) { + cl, err := arm.NewClient(moduleName+".AuthorizationClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AuthorizationClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// ConfirmConsentCode - Confirm valid consent code to suppress Authorizations anti-phishing page. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - authorizationProviderID - Identifier of the authorization provider. +// - authorizationID - Identifier of the authorization. +// - parameters - Create parameters. +// - options - AuthorizationClientConfirmConsentCodeOptions contains the optional parameters for the AuthorizationClient.ConfirmConsentCode +// method. +func (client *AuthorizationClient) ConfirmConsentCode(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, parameters AuthorizationConfirmConsentCodeRequestContract, options *AuthorizationClientConfirmConsentCodeOptions) (AuthorizationClientConfirmConsentCodeResponse, error) { + req, err := client.confirmConsentCodeCreateRequest(ctx, resourceGroupName, serviceName, authorizationProviderID, authorizationID, parameters, options) + if err != nil { + return AuthorizationClientConfirmConsentCodeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthorizationClientConfirmConsentCodeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AuthorizationClientConfirmConsentCodeResponse{}, runtime.NewResponseError(resp) + } + return client.confirmConsentCodeHandleResponse(resp) +} + +// confirmConsentCodeCreateRequest creates the ConfirmConsentCode request. +func (client *AuthorizationClient) confirmConsentCodeCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, parameters AuthorizationConfirmConsentCodeRequestContract, options *AuthorizationClientConfirmConsentCodeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/confirmConsentCode" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if authorizationProviderID == "" { + return nil, errors.New("parameter authorizationProviderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationProviderId}", url.PathEscape(authorizationProviderID)) + if authorizationID == "" { + return nil, errors.New("parameter authorizationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationId}", url.PathEscape(authorizationID)) + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// confirmConsentCodeHandleResponse handles the ConfirmConsentCode response. +func (client *AuthorizationClient) confirmConsentCodeHandleResponse(resp *http.Response) (AuthorizationClientConfirmConsentCodeResponse, error) { + result := AuthorizationClientConfirmConsentCodeResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + return result, nil +} + +// CreateOrUpdate - Creates or updates authorization. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - authorizationProviderID - Identifier of the authorization provider. +// - authorizationID - Identifier of the authorization. +// - parameters - Create parameters. +// - options - AuthorizationClientCreateOrUpdateOptions contains the optional parameters for the AuthorizationClient.CreateOrUpdate +// method. +func (client *AuthorizationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, parameters AuthorizationContract, options *AuthorizationClientCreateOrUpdateOptions) (AuthorizationClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, authorizationProviderID, authorizationID, parameters, options) + if err != nil { + return AuthorizationClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthorizationClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return AuthorizationClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AuthorizationClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, parameters AuthorizationContract, options *AuthorizationClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if authorizationProviderID == "" { + return nil, errors.New("parameter authorizationProviderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationProviderId}", url.PathEscape(authorizationProviderID)) + if authorizationID == "" { + return nil, errors.New("parameter authorizationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationId}", url.PathEscape(authorizationID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *AuthorizationClient) createOrUpdateHandleResponse(resp *http.Response) (AuthorizationClientCreateOrUpdateResponse, error) { + result := AuthorizationClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationContract); err != nil { + return AuthorizationClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes specific Authorization from the Authorization provider. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - authorizationProviderID - Identifier of the authorization provider. +// - authorizationID - Identifier of the authorization. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - AuthorizationClientDeleteOptions contains the optional parameters for the AuthorizationClient.Delete method. +func (client *AuthorizationClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, ifMatch string, options *AuthorizationClientDeleteOptions) (AuthorizationClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, authorizationProviderID, authorizationID, ifMatch, options) + if err != nil { + return AuthorizationClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthorizationClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AuthorizationClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return AuthorizationClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AuthorizationClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, ifMatch string, options *AuthorizationClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if authorizationProviderID == "" { + return nil, errors.New("parameter authorizationProviderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationProviderId}", url.PathEscape(authorizationProviderID)) + if authorizationID == "" { + return nil, errors.New("parameter authorizationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationId}", url.PathEscape(authorizationID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the authorization specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - authorizationProviderID - Identifier of the authorization provider. +// - authorizationID - Identifier of the authorization. +// - options - AuthorizationClientGetOptions contains the optional parameters for the AuthorizationClient.Get method. +func (client *AuthorizationClient) Get(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, options *AuthorizationClientGetOptions) (AuthorizationClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, authorizationProviderID, authorizationID, options) + if err != nil { + return AuthorizationClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthorizationClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AuthorizationClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AuthorizationClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, options *AuthorizationClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if authorizationProviderID == "" { + return nil, errors.New("parameter authorizationProviderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationProviderId}", url.PathEscape(authorizationProviderID)) + if authorizationID == "" { + return nil, errors.New("parameter authorizationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationId}", url.PathEscape(authorizationID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AuthorizationClient) getHandleResponse(resp *http.Response) (AuthorizationClientGetResponse, error) { + result := AuthorizationClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationContract); err != nil { + return AuthorizationClientGetResponse{}, err + } + return result, nil +} + +// NewListByAuthorizationProviderPager - Lists a collection of authorization providers defined within a authorization provider. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - authorizationProviderID - Identifier of the authorization provider. +// - options - AuthorizationClientListByAuthorizationProviderOptions contains the optional parameters for the AuthorizationClient.NewListByAuthorizationProviderPager +// method. +func (client *AuthorizationClient) NewListByAuthorizationProviderPager(resourceGroupName string, serviceName string, authorizationProviderID string, options *AuthorizationClientListByAuthorizationProviderOptions) *runtime.Pager[AuthorizationClientListByAuthorizationProviderResponse] { + return runtime.NewPager(runtime.PagingHandler[AuthorizationClientListByAuthorizationProviderResponse]{ + More: func(page AuthorizationClientListByAuthorizationProviderResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AuthorizationClientListByAuthorizationProviderResponse) (AuthorizationClientListByAuthorizationProviderResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByAuthorizationProviderCreateRequest(ctx, resourceGroupName, serviceName, authorizationProviderID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AuthorizationClientListByAuthorizationProviderResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthorizationClientListByAuthorizationProviderResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AuthorizationClientListByAuthorizationProviderResponse{}, runtime.NewResponseError(resp) + } + return client.listByAuthorizationProviderHandleResponse(resp) + }, + }) +} + +// listByAuthorizationProviderCreateRequest creates the ListByAuthorizationProvider request. +func (client *AuthorizationClient) listByAuthorizationProviderCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, options *AuthorizationClientListByAuthorizationProviderOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if authorizationProviderID == "" { + return nil, errors.New("parameter authorizationProviderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationProviderId}", url.PathEscape(authorizationProviderID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByAuthorizationProviderHandleResponse handles the ListByAuthorizationProvider response. +func (client *AuthorizationClient) listByAuthorizationProviderHandleResponse(resp *http.Response) (AuthorizationClientListByAuthorizationProviderResponse, error) { + result := AuthorizationClientListByAuthorizationProviderResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationCollection); err != nil { + return AuthorizationClientListByAuthorizationProviderResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/authorizationaccesspolicy_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/authorizationaccesspolicy_client.go new file mode 100644 index 000000000000..07d33b3ce192 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/authorizationaccesspolicy_client.go @@ -0,0 +1,358 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// AuthorizationAccessPolicyClient contains the methods for the AuthorizationAccessPolicy group. +// Don't use this type directly, use NewAuthorizationAccessPolicyClient() instead. +type AuthorizationAccessPolicyClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAuthorizationAccessPolicyClient creates a new instance of AuthorizationAccessPolicyClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAuthorizationAccessPolicyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AuthorizationAccessPolicyClient, error) { + cl, err := arm.NewClient(moduleName+".AuthorizationAccessPolicyClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AuthorizationAccessPolicyClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates Authorization Access Policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - authorizationProviderID - Identifier of the authorization provider. +// - authorizationID - Identifier of the authorization. +// - authorizationAccessPolicyID - Identifier of the authorization access policy. +// - parameters - Create parameters. +// - options - AuthorizationAccessPolicyClientCreateOrUpdateOptions contains the optional parameters for the AuthorizationAccessPolicyClient.CreateOrUpdate +// method. +func (client *AuthorizationAccessPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, authorizationAccessPolicyID string, parameters AuthorizationAccessPolicyContract, options *AuthorizationAccessPolicyClientCreateOrUpdateOptions) (AuthorizationAccessPolicyClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, authorizationProviderID, authorizationID, authorizationAccessPolicyID, parameters, options) + if err != nil { + return AuthorizationAccessPolicyClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthorizationAccessPolicyClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return AuthorizationAccessPolicyClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AuthorizationAccessPolicyClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, authorizationAccessPolicyID string, parameters AuthorizationAccessPolicyContract, options *AuthorizationAccessPolicyClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if authorizationProviderID == "" { + return nil, errors.New("parameter authorizationProviderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationProviderId}", url.PathEscape(authorizationProviderID)) + if authorizationID == "" { + return nil, errors.New("parameter authorizationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationId}", url.PathEscape(authorizationID)) + if authorizationAccessPolicyID == "" { + return nil, errors.New("parameter authorizationAccessPolicyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationAccessPolicyId}", url.PathEscape(authorizationAccessPolicyID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *AuthorizationAccessPolicyClient) createOrUpdateHandleResponse(resp *http.Response) (AuthorizationAccessPolicyClientCreateOrUpdateResponse, error) { + result := AuthorizationAccessPolicyClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationAccessPolicyContract); err != nil { + return AuthorizationAccessPolicyClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes specific access policy from the Authorization. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - authorizationProviderID - Identifier of the authorization provider. +// - authorizationID - Identifier of the authorization. +// - authorizationAccessPolicyID - Identifier of the authorization access policy. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - AuthorizationAccessPolicyClientDeleteOptions contains the optional parameters for the AuthorizationAccessPolicyClient.Delete +// method. +func (client *AuthorizationAccessPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, authorizationAccessPolicyID string, ifMatch string, options *AuthorizationAccessPolicyClientDeleteOptions) (AuthorizationAccessPolicyClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, authorizationProviderID, authorizationID, authorizationAccessPolicyID, ifMatch, options) + if err != nil { + return AuthorizationAccessPolicyClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthorizationAccessPolicyClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AuthorizationAccessPolicyClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return AuthorizationAccessPolicyClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AuthorizationAccessPolicyClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, authorizationAccessPolicyID string, ifMatch string, options *AuthorizationAccessPolicyClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if authorizationProviderID == "" { + return nil, errors.New("parameter authorizationProviderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationProviderId}", url.PathEscape(authorizationProviderID)) + if authorizationID == "" { + return nil, errors.New("parameter authorizationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationId}", url.PathEscape(authorizationID)) + if authorizationAccessPolicyID == "" { + return nil, errors.New("parameter authorizationAccessPolicyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationAccessPolicyId}", url.PathEscape(authorizationAccessPolicyID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the authorization access policy specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - authorizationProviderID - Identifier of the authorization provider. +// - authorizationID - Identifier of the authorization. +// - authorizationAccessPolicyID - Identifier of the authorization access policy. +// - options - AuthorizationAccessPolicyClientGetOptions contains the optional parameters for the AuthorizationAccessPolicyClient.Get +// method. +func (client *AuthorizationAccessPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, authorizationAccessPolicyID string, options *AuthorizationAccessPolicyClientGetOptions) (AuthorizationAccessPolicyClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, authorizationProviderID, authorizationID, authorizationAccessPolicyID, options) + if err != nil { + return AuthorizationAccessPolicyClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthorizationAccessPolicyClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AuthorizationAccessPolicyClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AuthorizationAccessPolicyClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, authorizationAccessPolicyID string, options *AuthorizationAccessPolicyClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if authorizationProviderID == "" { + return nil, errors.New("parameter authorizationProviderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationProviderId}", url.PathEscape(authorizationProviderID)) + if authorizationID == "" { + return nil, errors.New("parameter authorizationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationId}", url.PathEscape(authorizationID)) + if authorizationAccessPolicyID == "" { + return nil, errors.New("parameter authorizationAccessPolicyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationAccessPolicyId}", url.PathEscape(authorizationAccessPolicyID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AuthorizationAccessPolicyClient) getHandleResponse(resp *http.Response) (AuthorizationAccessPolicyClientGetResponse, error) { + result := AuthorizationAccessPolicyClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationAccessPolicyContract); err != nil { + return AuthorizationAccessPolicyClientGetResponse{}, err + } + return result, nil +} + +// NewListByAuthorizationPager - Lists a collection of authorization access policy defined within a authorization. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - authorizationProviderID - Identifier of the authorization provider. +// - authorizationID - Identifier of the authorization. +// - options - AuthorizationAccessPolicyClientListByAuthorizationOptions contains the optional parameters for the AuthorizationAccessPolicyClient.NewListByAuthorizationPager +// method. +func (client *AuthorizationAccessPolicyClient) NewListByAuthorizationPager(resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, options *AuthorizationAccessPolicyClientListByAuthorizationOptions) *runtime.Pager[AuthorizationAccessPolicyClientListByAuthorizationResponse] { + return runtime.NewPager(runtime.PagingHandler[AuthorizationAccessPolicyClientListByAuthorizationResponse]{ + More: func(page AuthorizationAccessPolicyClientListByAuthorizationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AuthorizationAccessPolicyClientListByAuthorizationResponse) (AuthorizationAccessPolicyClientListByAuthorizationResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByAuthorizationCreateRequest(ctx, resourceGroupName, serviceName, authorizationProviderID, authorizationID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AuthorizationAccessPolicyClientListByAuthorizationResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthorizationAccessPolicyClientListByAuthorizationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AuthorizationAccessPolicyClientListByAuthorizationResponse{}, runtime.NewResponseError(resp) + } + return client.listByAuthorizationHandleResponse(resp) + }, + }) +} + +// listByAuthorizationCreateRequest creates the ListByAuthorization request. +func (client *AuthorizationAccessPolicyClient) listByAuthorizationCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, options *AuthorizationAccessPolicyClientListByAuthorizationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if authorizationProviderID == "" { + return nil, errors.New("parameter authorizationProviderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationProviderId}", url.PathEscape(authorizationProviderID)) + if authorizationID == "" { + return nil, errors.New("parameter authorizationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationId}", url.PathEscape(authorizationID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByAuthorizationHandleResponse handles the ListByAuthorization response. +func (client *AuthorizationAccessPolicyClient) listByAuthorizationHandleResponse(resp *http.Response) (AuthorizationAccessPolicyClientListByAuthorizationResponse, error) { + result := AuthorizationAccessPolicyClientListByAuthorizationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationAccessPolicyCollection); err != nil { + return AuthorizationAccessPolicyClientListByAuthorizationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/authorizationloginlinks_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/authorizationloginlinks_client.go new file mode 100644 index 000000000000..1ae88e5cddab --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/authorizationloginlinks_client.go @@ -0,0 +1,117 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AuthorizationLoginLinksClient contains the methods for the AuthorizationLoginLinks group. +// Don't use this type directly, use NewAuthorizationLoginLinksClient() instead. +type AuthorizationLoginLinksClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAuthorizationLoginLinksClient creates a new instance of AuthorizationLoginLinksClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAuthorizationLoginLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AuthorizationLoginLinksClient, error) { + cl, err := arm.NewClient(moduleName+".AuthorizationLoginLinksClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AuthorizationLoginLinksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Post - Gets authorization login links. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - authorizationProviderID - Identifier of the authorization provider. +// - authorizationID - Identifier of the authorization. +// - parameters - Create parameters. +// - options - AuthorizationLoginLinksClientPostOptions contains the optional parameters for the AuthorizationLoginLinksClient.Post +// method. +func (client *AuthorizationLoginLinksClient) Post(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, parameters AuthorizationLoginRequestContract, options *AuthorizationLoginLinksClientPostOptions) (AuthorizationLoginLinksClientPostResponse, error) { + req, err := client.postCreateRequest(ctx, resourceGroupName, serviceName, authorizationProviderID, authorizationID, parameters, options) + if err != nil { + return AuthorizationLoginLinksClientPostResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthorizationLoginLinksClientPostResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AuthorizationLoginLinksClientPostResponse{}, runtime.NewResponseError(resp) + } + return client.postHandleResponse(resp) +} + +// postCreateRequest creates the Post request. +func (client *AuthorizationLoginLinksClient) postCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, authorizationID string, parameters AuthorizationLoginRequestContract, options *AuthorizationLoginLinksClientPostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/getLoginLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if authorizationProviderID == "" { + return nil, errors.New("parameter authorizationProviderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationProviderId}", url.PathEscape(authorizationProviderID)) + if authorizationID == "" { + return nil, errors.New("parameter authorizationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationId}", url.PathEscape(authorizationID)) + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// postHandleResponse handles the Post response. +func (client *AuthorizationLoginLinksClient) postHandleResponse(resp *http.Response) (AuthorizationLoginLinksClientPostResponse, error) { + result := AuthorizationLoginLinksClientPostResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationLoginResponseContract); err != nil { + return AuthorizationLoginLinksClientPostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/authorizationprovider_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/authorizationprovider_client.go new file mode 100644 index 000000000000..92ba990c6421 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/authorizationprovider_client.go @@ -0,0 +1,318 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// AuthorizationProviderClient contains the methods for the AuthorizationProvider group. +// Don't use this type directly, use NewAuthorizationProviderClient() instead. +type AuthorizationProviderClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAuthorizationProviderClient creates a new instance of AuthorizationProviderClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAuthorizationProviderClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AuthorizationProviderClient, error) { + cl, err := arm.NewClient(moduleName+".AuthorizationProviderClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AuthorizationProviderClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates authorization provider. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - authorizationProviderID - Identifier of the authorization provider. +// - parameters - Create parameters. +// - options - AuthorizationProviderClientCreateOrUpdateOptions contains the optional parameters for the AuthorizationProviderClient.CreateOrUpdate +// method. +func (client *AuthorizationProviderClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, parameters AuthorizationProviderContract, options *AuthorizationProviderClientCreateOrUpdateOptions) (AuthorizationProviderClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, authorizationProviderID, parameters, options) + if err != nil { + return AuthorizationProviderClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthorizationProviderClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return AuthorizationProviderClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AuthorizationProviderClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, parameters AuthorizationProviderContract, options *AuthorizationProviderClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if authorizationProviderID == "" { + return nil, errors.New("parameter authorizationProviderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationProviderId}", url.PathEscape(authorizationProviderID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *AuthorizationProviderClient) createOrUpdateHandleResponse(resp *http.Response) (AuthorizationProviderClientCreateOrUpdateResponse, error) { + result := AuthorizationProviderClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationProviderContract); err != nil { + return AuthorizationProviderClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes specific authorization provider from the API Management service instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - authorizationProviderID - Identifier of the authorization provider. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - AuthorizationProviderClientDeleteOptions contains the optional parameters for the AuthorizationProviderClient.Delete +// method. +func (client *AuthorizationProviderClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, ifMatch string, options *AuthorizationProviderClientDeleteOptions) (AuthorizationProviderClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, authorizationProviderID, ifMatch, options) + if err != nil { + return AuthorizationProviderClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthorizationProviderClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AuthorizationProviderClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return AuthorizationProviderClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AuthorizationProviderClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, ifMatch string, options *AuthorizationProviderClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if authorizationProviderID == "" { + return nil, errors.New("parameter authorizationProviderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationProviderId}", url.PathEscape(authorizationProviderID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the authorization provider specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - authorizationProviderID - Identifier of the authorization provider. +// - options - AuthorizationProviderClientGetOptions contains the optional parameters for the AuthorizationProviderClient.Get +// method. +func (client *AuthorizationProviderClient) Get(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, options *AuthorizationProviderClientGetOptions) (AuthorizationProviderClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, authorizationProviderID, options) + if err != nil { + return AuthorizationProviderClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthorizationProviderClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AuthorizationProviderClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AuthorizationProviderClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, authorizationProviderID string, options *AuthorizationProviderClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if authorizationProviderID == "" { + return nil, errors.New("parameter authorizationProviderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationProviderId}", url.PathEscape(authorizationProviderID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AuthorizationProviderClient) getHandleResponse(resp *http.Response) (AuthorizationProviderClientGetResponse, error) { + result := AuthorizationProviderClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationProviderContract); err != nil { + return AuthorizationProviderClientGetResponse{}, err + } + return result, nil +} + +// NewListByServicePager - Lists a collection of authorization providers defined within a service instance. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - options - AuthorizationProviderClientListByServiceOptions contains the optional parameters for the AuthorizationProviderClient.NewListByServicePager +// method. +func (client *AuthorizationProviderClient) NewListByServicePager(resourceGroupName string, serviceName string, options *AuthorizationProviderClientListByServiceOptions) *runtime.Pager[AuthorizationProviderClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[AuthorizationProviderClientListByServiceResponse]{ + More: func(page AuthorizationProviderClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AuthorizationProviderClientListByServiceResponse) (AuthorizationProviderClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AuthorizationProviderClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthorizationProviderClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AuthorizationProviderClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *AuthorizationProviderClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *AuthorizationProviderClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *AuthorizationProviderClient) listByServiceHandleResponse(resp *http.Response) (AuthorizationProviderClientListByServiceResponse, error) { + result := AuthorizationProviderClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationProviderCollection); err != nil { + return AuthorizationProviderClientListByServiceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/authorizationserver_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/authorizationserver_client.go index 263824066929..d9fa3785202a 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/authorizationserver_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/authorizationserver_client.go @@ -30,8 +30,7 @@ type AuthorizationServerClient struct { } // NewAuthorizationServerClient creates a new instance of AuthorizationServerClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAuthorizationServerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AuthorizationServerClient, error) { @@ -49,8 +48,8 @@ func NewAuthorizationServerClient(subscriptionID string, credential azcore.Token // CreateOrUpdate - Creates new authorization server or updates an existing authorization server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - authsid - Identifier of the authorization server. // - parameters - Create or update parameters. @@ -95,7 +94,7 @@ func (client *AuthorizationServerClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -119,8 +118,8 @@ func (client *AuthorizationServerClient) createOrUpdateHandleResponse(resp *http // Delete - Deletes specific authorization server instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - authsid - Identifier of the authorization server. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -166,7 +165,7 @@ func (client *AuthorizationServerClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -176,8 +175,8 @@ func (client *AuthorizationServerClient) deleteCreateRequest(ctx context.Context // Get - Gets the details of the authorization server specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - authsid - Identifier of the authorization server. // - options - AuthorizationServerClientGetOptions contains the optional parameters for the AuthorizationServerClient.Get method. @@ -220,7 +219,7 @@ func (client *AuthorizationServerClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,8 +239,8 @@ func (client *AuthorizationServerClient) getHandleResponse(resp *http.Response) // GetEntityTag - Gets the entity state (Etag) version of the authorizationServer specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - authsid - Identifier of the authorization server. // - options - AuthorizationServerClientGetEntityTagOptions contains the optional parameters for the AuthorizationServerClient.GetEntityTag @@ -285,7 +284,7 @@ func (client *AuthorizationServerClient) getEntityTagCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -303,8 +302,8 @@ func (client *AuthorizationServerClient) getEntityTagHandleResponse(resp *http.R // NewListByServicePager - Lists a collection of authorization servers defined within a service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - AuthorizationServerClientListByServiceOptions contains the optional parameters for the AuthorizationServerClient.NewListByServicePager // method. @@ -365,7 +364,7 @@ func (client *AuthorizationServerClient) listByServiceCreateRequest(ctx context. if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -383,8 +382,8 @@ func (client *AuthorizationServerClient) listByServiceHandleResponse(resp *http. // ListSecrets - Gets the client secret details of the authorization server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - authsid - Identifier of the authorization server. // - options - AuthorizationServerClientListSecretsOptions contains the optional parameters for the AuthorizationServerClient.ListSecrets @@ -428,7 +427,7 @@ func (client *AuthorizationServerClient) listSecretsCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -449,8 +448,8 @@ func (client *AuthorizationServerClient) listSecretsHandleResponse(resp *http.Re // Update - Updates the details of the authorization server specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - authsid - Identifier of the authorization server. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -497,7 +496,7 @@ func (client *AuthorizationServerClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/authorizationserver_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/authorizationserver_client_example_test.go deleted file mode 100644 index e8980a287cb1..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/authorizationserver_client_example_test.go +++ /dev/null @@ -1,321 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListAuthorizationServers.json -func ExampleAuthorizationServerClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAuthorizationServerClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.AuthorizationServerClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.AuthorizationServerCollection = armapimanagement.AuthorizationServerCollection{ - // Value: []*armapimanagement.AuthorizationServerContract{ - // { - // Name: to.Ptr("newauthServer"), - // Type: to.Ptr("Microsoft.ApiManagement/service/authorizationServers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationServers/newauthServer"), - // Properties: &armapimanagement.AuthorizationServerContractProperties{ - // Description: to.Ptr("test server"), - // AuthorizationMethods: []*armapimanagement.AuthorizationMethod{ - // to.Ptr(armapimanagement.AuthorizationMethodGET)}, - // BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethod{ - // to.Ptr(armapimanagement.BearerTokenSendingMethodAuthorizationHeader)}, - // DefaultScope: to.Ptr("read write"), - // ResourceOwnerPassword: to.Ptr("pwd"), - // ResourceOwnerUsername: to.Ptr("un"), - // SupportState: to.Ptr(true), - // TokenEndpoint: to.Ptr("https://www.contoso.com/oauth2/token"), - // AuthorizationEndpoint: to.Ptr("https://www.contoso.com/oauth2/auth"), - // ClientID: to.Ptr("1"), - // ClientRegistrationEndpoint: to.Ptr("https://www.contoso.com/apps"), - // DisplayName: to.Ptr("test2"), - // GrantTypes: []*armapimanagement.GrantType{ - // to.Ptr(armapimanagement.GrantTypeAuthorizationCode), - // to.Ptr(armapimanagement.GrantTypeImplicit)}, - // }, - // }, - // { - // Name: to.Ptr("newauthServer2"), - // Type: to.Ptr("Microsoft.ApiManagement/service/authorizationServers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationServers/newauthServer2"), - // Properties: &armapimanagement.AuthorizationServerContractProperties{ - // Description: to.Ptr("test server"), - // AuthorizationMethods: []*armapimanagement.AuthorizationMethod{ - // to.Ptr(armapimanagement.AuthorizationMethodGET)}, - // BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethod{ - // to.Ptr(armapimanagement.BearerTokenSendingMethodAuthorizationHeader)}, - // ClientAuthenticationMethod: []*armapimanagement.ClientAuthenticationMethod{ - // to.Ptr(armapimanagement.ClientAuthenticationMethodBasic)}, - // DefaultScope: to.Ptr("read write"), - // ResourceOwnerPassword: to.Ptr("pwd"), - // ResourceOwnerUsername: to.Ptr("un"), - // SupportState: to.Ptr(true), - // TokenEndpoint: to.Ptr("https://www.contoso.com/oauth2/token"), - // AuthorizationEndpoint: to.Ptr("https://www.contoso.com/oauth2/auth"), - // ClientID: to.Ptr("1"), - // ClientRegistrationEndpoint: to.Ptr("https://www.contoso.com/apps"), - // DisplayName: to.Ptr("test3"), - // GrantTypes: []*armapimanagement.GrantType{ - // to.Ptr(armapimanagement.GrantTypeAuthorizationCode), - // to.Ptr(armapimanagement.GrantTypeImplicit)}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadAuthorizationServer.json -func ExampleAuthorizationServerClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAuthorizationServerClient().GetEntityTag(ctx, "rg1", "apimService1", "newauthServer2", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetAuthorizationServer.json -func ExampleAuthorizationServerClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAuthorizationServerClient().Get(ctx, "rg1", "apimService1", "newauthServer2", 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.AuthorizationServerContract = armapimanagement.AuthorizationServerContract{ - // Name: to.Ptr("newauthServer2"), - // Type: to.Ptr("Microsoft.ApiManagement/service/authorizationServers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationServers/newauthServer2"), - // Properties: &armapimanagement.AuthorizationServerContractProperties{ - // Description: to.Ptr("test server"), - // AuthorizationMethods: []*armapimanagement.AuthorizationMethod{ - // to.Ptr(armapimanagement.AuthorizationMethodGET)}, - // BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethod{ - // to.Ptr(armapimanagement.BearerTokenSendingMethodAuthorizationHeader)}, - // ClientAuthenticationMethod: []*armapimanagement.ClientAuthenticationMethod{ - // to.Ptr(armapimanagement.ClientAuthenticationMethodBasic)}, - // DefaultScope: to.Ptr("read write"), - // ResourceOwnerPassword: to.Ptr("pwd"), - // ResourceOwnerUsername: to.Ptr("un"), - // SupportState: to.Ptr(true), - // TokenEndpoint: to.Ptr("https://www.contoso.com/oauth2/token"), - // AuthorizationEndpoint: to.Ptr("https://www.contoso.com/oauth2/auth"), - // ClientID: to.Ptr("1"), - // ClientRegistrationEndpoint: to.Ptr("https://www.contoso.com/apps"), - // DisplayName: to.Ptr("test3"), - // GrantTypes: []*armapimanagement.GrantType{ - // to.Ptr(armapimanagement.GrantTypeAuthorizationCode), - // to.Ptr(armapimanagement.GrantTypeImplicit)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateAuthorizationServer.json -func ExampleAuthorizationServerClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAuthorizationServerClient().CreateOrUpdate(ctx, "rg1", "apimService1", "newauthServer", armapimanagement.AuthorizationServerContract{ - Properties: &armapimanagement.AuthorizationServerContractProperties{ - Description: to.Ptr("test server"), - AuthorizationMethods: []*armapimanagement.AuthorizationMethod{ - to.Ptr(armapimanagement.AuthorizationMethodGET)}, - BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethod{ - to.Ptr(armapimanagement.BearerTokenSendingMethodAuthorizationHeader)}, - DefaultScope: to.Ptr("read write"), - ResourceOwnerPassword: to.Ptr("pwd"), - ResourceOwnerUsername: to.Ptr("un"), - SupportState: to.Ptr(true), - TokenEndpoint: to.Ptr("https://www.contoso.com/oauth2/token"), - AuthorizationEndpoint: to.Ptr("https://www.contoso.com/oauth2/auth"), - ClientID: to.Ptr("1"), - ClientRegistrationEndpoint: to.Ptr("https://www.contoso.com/apps"), - ClientSecret: to.Ptr("2"), - DisplayName: to.Ptr("test2"), - GrantTypes: []*armapimanagement.GrantType{ - to.Ptr(armapimanagement.GrantTypeAuthorizationCode), - to.Ptr(armapimanagement.GrantTypeImplicit)}, - }, - }, &armapimanagement.AuthorizationServerClientCreateOrUpdateOptions{IfMatch: 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.AuthorizationServerContract = armapimanagement.AuthorizationServerContract{ - // Name: to.Ptr("newauthServer"), - // Type: to.Ptr("Microsoft.ApiManagement/service/authorizationServers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationServers/newauthServer"), - // Properties: &armapimanagement.AuthorizationServerContractProperties{ - // Description: to.Ptr("test server"), - // AuthorizationMethods: []*armapimanagement.AuthorizationMethod{ - // to.Ptr(armapimanagement.AuthorizationMethodGET)}, - // BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethod{ - // to.Ptr(armapimanagement.BearerTokenSendingMethodAuthorizationHeader)}, - // DefaultScope: to.Ptr("read write"), - // ResourceOwnerPassword: to.Ptr("pwd"), - // ResourceOwnerUsername: to.Ptr("un"), - // SupportState: to.Ptr(true), - // TokenEndpoint: to.Ptr("https://www.contoso.com/oauth2/token"), - // AuthorizationEndpoint: to.Ptr("https://www.contoso.com/oauth2/auth"), - // ClientID: to.Ptr("1"), - // ClientRegistrationEndpoint: to.Ptr("https://www.contoso.com/apps"), - // DisplayName: to.Ptr("test2"), - // GrantTypes: []*armapimanagement.GrantType{ - // to.Ptr(armapimanagement.GrantTypeAuthorizationCode), - // to.Ptr(armapimanagement.GrantTypeImplicit)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateAuthorizationServer.json -func ExampleAuthorizationServerClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAuthorizationServerClient().Update(ctx, "rg1", "apimService1", "newauthServer", "*", armapimanagement.AuthorizationServerUpdateContract{ - Properties: &armapimanagement.AuthorizationServerUpdateContractProperties{ - ClientID: to.Ptr("update"), - ClientSecret: to.Ptr("updated"), - }, - }, 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.AuthorizationServerContract = armapimanagement.AuthorizationServerContract{ - // Name: to.Ptr("newauthServer"), - // Type: to.Ptr("Microsoft.ApiManagement/service/authorizationServers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationServers/newauthServer"), - // Properties: &armapimanagement.AuthorizationServerContractProperties{ - // Description: to.Ptr("test server"), - // AuthorizationMethods: []*armapimanagement.AuthorizationMethod{ - // to.Ptr(armapimanagement.AuthorizationMethodGET)}, - // BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethod{ - // to.Ptr(armapimanagement.BearerTokenSendingMethodAuthorizationHeader)}, - // ClientAuthenticationMethod: []*armapimanagement.ClientAuthenticationMethod{ - // to.Ptr(armapimanagement.ClientAuthenticationMethodBasic)}, - // DefaultScope: to.Ptr("read write"), - // ResourceOwnerPassword: to.Ptr("pwd"), - // ResourceOwnerUsername: to.Ptr("un"), - // SupportState: to.Ptr(true), - // TokenEndpoint: to.Ptr("https://www.contoso.com/oauth2/token"), - // AuthorizationEndpoint: to.Ptr("https://www.contoso.com/oauth2/auth"), - // ClientID: to.Ptr("updated"), - // ClientRegistrationEndpoint: to.Ptr("https://www.contoso.com/apps"), - // DisplayName: to.Ptr("test3"), - // GrantTypes: []*armapimanagement.GrantType{ - // to.Ptr(armapimanagement.GrantTypeAuthorizationCode), - // to.Ptr(armapimanagement.GrantTypeImplicit)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteAuthorizationServer.json -func ExampleAuthorizationServerClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAuthorizationServerClient().Delete(ctx, "rg1", "apimService1", "newauthServer2", "*", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementAuthorizationServerListSecrets.json -func ExampleAuthorizationServerClient_ListSecrets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAuthorizationServerClient().ListSecrets(ctx, "rg1", "apimService1", "newauthServer2", 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.AuthorizationServerSecretsContract = armapimanagement.AuthorizationServerSecretsContract{ - // ClientSecret: to.Ptr("2"), - // ResourceOwnerPassword: to.Ptr("pwd"), - // ResourceOwnerUsername: to.Ptr("un"), - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/autorest.md b/sdk/resourcemanager/apimanagement/armapimanagement/autorest.md index 86050977612c..7e7e00fbd463 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/autorest.md +++ b/sdk/resourcemanager/apimanagement/armapimanagement/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/apimanagement/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/apimanagement/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.1 +module-version: 2.0.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/backend_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/backend_client.go index fcaf88b0aac3..18948931cc65 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/backend_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/backend_client.go @@ -30,8 +30,7 @@ type BackendClient struct { } // NewBackendClient creates a new instance of BackendClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewBackendClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackendClient, error) { @@ -49,8 +48,8 @@ func NewBackendClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Creates or Updates a backend. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - backendID - Identifier of the Backend entity. Must be unique in the current API Management service instance. // - parameters - Create parameters. @@ -94,7 +93,7 @@ func (client *BackendClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -118,8 +117,8 @@ func (client *BackendClient) createOrUpdateHandleResponse(resp *http.Response) ( // Delete - Deletes the specified backend. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - backendID - Identifier of the Backend entity. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -164,7 +163,7 @@ func (client *BackendClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -174,8 +173,8 @@ func (client *BackendClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Gets the details of the backend specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - backendID - Identifier of the Backend entity. Must be unique in the current API Management service instance. // - options - BackendClientGetOptions contains the optional parameters for the BackendClient.Get method. @@ -218,7 +217,7 @@ func (client *BackendClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -238,8 +237,8 @@ func (client *BackendClient) getHandleResponse(resp *http.Response) (BackendClie // GetEntityTag - Gets the entity state (Etag) version of the backend specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - backendID - Identifier of the Backend entity. Must be unique in the current API Management service instance. // - options - BackendClientGetEntityTagOptions contains the optional parameters for the BackendClient.GetEntityTag method. @@ -282,7 +281,7 @@ func (client *BackendClient) getEntityTagCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -300,8 +299,8 @@ func (client *BackendClient) getEntityTagHandleResponse(resp *http.Response) (Ba // NewListByServicePager - Lists a collection of backends in the specified service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - BackendClientListByServiceOptions contains the optional parameters for the BackendClient.NewListByServicePager // method. @@ -362,7 +361,7 @@ func (client *BackendClient) listByServiceCreateRequest(ctx context.Context, res if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -377,12 +376,12 @@ func (client *BackendClient) listByServiceHandleResponse(resp *http.Response) (B return result, nil } -// Reconnect - Notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no timeout -// was specified, timeout of 2 minutes is used. +// Reconnect - Notifies the API Management gateway to create a new connection to the backend after the specified timeout. +// If no timeout was specified, timeout of 2 minutes is used. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - backendID - Identifier of the Backend entity. Must be unique in the current API Management service instance. // - options - BackendClientReconnectOptions contains the optional parameters for the BackendClient.Reconnect method. @@ -425,7 +424,7 @@ func (client *BackendClient) reconnectCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Parameters != nil { @@ -437,8 +436,8 @@ func (client *BackendClient) reconnectCreateRequest(ctx context.Context, resourc // Update - Updates an existing backend. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - backendID - Identifier of the Backend entity. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -484,7 +483,7 @@ func (client *BackendClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/backend_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/backend_client_example_test.go deleted file mode 100644 index f0eb11db11de..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/backend_client_example_test.go +++ /dev/null @@ -1,423 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListBackends.json -func ExampleBackendClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackendClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.BackendClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.BackendCollection = armapimanagement.BackendCollection{ - // Count: to.Ptr[int64](2), - // Value: []*armapimanagement.BackendContract{ - // { - // Name: to.Ptr("proxybackend"), - // Type: to.Ptr("Microsoft.ApiManagement/service/backends"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/backends/proxybackend"), - // Properties: &armapimanagement.BackendContractProperties{ - // Description: to.Ptr("description5308"), - // Credentials: &armapimanagement.BackendCredentialsContract{ - // Authorization: &armapimanagement.BackendAuthorizationHeaderCredentials{ - // Parameter: to.Ptr("opensesma"), - // Scheme: to.Ptr("Basic"), - // }, - // Header: map[string][]*string{ - // "x-my-1": []*string{ - // to.Ptr("val1"), - // to.Ptr("val2")}, - // }, - // Query: map[string][]*string{ - // "sv": []*string{ - // to.Ptr("xx"), - // to.Ptr("bb"), - // to.Ptr("cc")}, - // }, - // }, - // Proxy: &armapimanagement.BackendProxyContract{ - // Password: to.Ptr(""), - // URL: to.Ptr("http://192.168.1.1:8080"), - // Username: to.Ptr("Contoso\\admin"), - // }, - // TLS: &armapimanagement.BackendTLSProperties{ - // ValidateCertificateChain: to.Ptr(false), - // ValidateCertificateName: to.Ptr(false), - // }, - // URL: to.Ptr("https://backendname2644/"), - // Protocol: to.Ptr(armapimanagement.BackendProtocolHTTP), - // }, - // }, - // { - // Name: to.Ptr("sfbackend"), - // Type: to.Ptr("Microsoft.ApiManagement/service/backends"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/backends/sfbackend"), - // Properties: &armapimanagement.BackendContractProperties{ - // Description: to.Ptr("Service Fabric Test App 1"), - // Properties: &armapimanagement.BackendProperties{ - // ServiceFabricCluster: &armapimanagement.BackendServiceFabricClusterProperties{ - // ClientCertificateID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1"), - // ManagementEndpoints: []*string{ - // to.Ptr("https://somecluster.com")}, - // MaxPartitionResolutionRetries: to.Ptr[int32](5), - // ServerX509Names: []*armapimanagement.X509CertificateName{ - // { - // Name: to.Ptr("ServerCommonName1"), - // IssuerCertificateThumbprint: to.Ptr("IssuerCertificateThumbprint1"), - // }}, - // }, - // }, - // URL: to.Ptr("fabric:/mytestapp/mytestservice"), - // Protocol: to.Ptr(armapimanagement.BackendProtocolHTTP), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadBackend.json -func ExampleBackendClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewBackendClient().GetEntityTag(ctx, "rg1", "apimService1", "sfbackend", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetBackend.json -func ExampleBackendClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackendClient().Get(ctx, "rg1", "apimService1", "sfbackend", 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.BackendContract = armapimanagement.BackendContract{ - // Name: to.Ptr("sfbackend"), - // Type: to.Ptr("Microsoft.ApiManagement/service/backends"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/backends/sfbackend"), - // Properties: &armapimanagement.BackendContractProperties{ - // Description: to.Ptr("Service Fabric Test App 1"), - // Properties: &armapimanagement.BackendProperties{ - // ServiceFabricCluster: &armapimanagement.BackendServiceFabricClusterProperties{ - // ClientCertificateID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1"), - // ManagementEndpoints: []*string{ - // to.Ptr("https://somecluster.com")}, - // MaxPartitionResolutionRetries: to.Ptr[int32](5), - // ServerX509Names: []*armapimanagement.X509CertificateName{ - // { - // Name: to.Ptr("ServerCommonName1"), - // IssuerCertificateThumbprint: to.Ptr("IssuerCertificateThumbprint1"), - // }}, - // }, - // }, - // URL: to.Ptr("fabric:/mytestapp/mytestservice"), - // Protocol: to.Ptr(armapimanagement.BackendProtocolHTTP), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateBackendProxyBackend.json -func ExampleBackendClient_CreateOrUpdate_apiManagementCreateBackendProxyBackend() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackendClient().CreateOrUpdate(ctx, "rg1", "apimService1", "proxybackend", armapimanagement.BackendContract{ - Properties: &armapimanagement.BackendContractProperties{ - Description: to.Ptr("description5308"), - Credentials: &armapimanagement.BackendCredentialsContract{ - Authorization: &armapimanagement.BackendAuthorizationHeaderCredentials{ - Parameter: to.Ptr("opensesma"), - Scheme: to.Ptr("Basic"), - }, - Header: map[string][]*string{ - "x-my-1": { - to.Ptr("val1"), - to.Ptr("val2")}, - }, - Query: map[string][]*string{ - "sv": { - to.Ptr("xx"), - to.Ptr("bb"), - to.Ptr("cc")}, - }, - }, - Proxy: &armapimanagement.BackendProxyContract{ - Password: to.Ptr(""), - URL: to.Ptr("http://192.168.1.1:8080"), - Username: to.Ptr("Contoso\\admin"), - }, - TLS: &armapimanagement.BackendTLSProperties{ - ValidateCertificateChain: to.Ptr(true), - ValidateCertificateName: to.Ptr(true), - }, - URL: to.Ptr("https://backendname2644/"), - Protocol: to.Ptr(armapimanagement.BackendProtocolHTTP), - }, - }, &armapimanagement.BackendClientCreateOrUpdateOptions{IfMatch: 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.BackendContract = armapimanagement.BackendContract{ - // Name: to.Ptr("proxybackend"), - // Type: to.Ptr("Microsoft.ApiManagement/service/backends"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/backends/proxybackend"), - // Properties: &armapimanagement.BackendContractProperties{ - // Description: to.Ptr("description5308"), - // Credentials: &armapimanagement.BackendCredentialsContract{ - // Authorization: &armapimanagement.BackendAuthorizationHeaderCredentials{ - // Parameter: to.Ptr("opensesma"), - // Scheme: to.Ptr("Basic"), - // }, - // Header: map[string][]*string{ - // "x-my-1": []*string{ - // to.Ptr("val1"), - // to.Ptr("val2")}, - // }, - // Query: map[string][]*string{ - // "sv": []*string{ - // to.Ptr("xx"), - // to.Ptr("bb"), - // to.Ptr("cc")}, - // }, - // }, - // Proxy: &armapimanagement.BackendProxyContract{ - // Password: to.Ptr(""), - // URL: to.Ptr("http://192.168.1.1:8080"), - // Username: to.Ptr("Contoso\\admin"), - // }, - // TLS: &armapimanagement.BackendTLSProperties{ - // ValidateCertificateChain: to.Ptr(false), - // ValidateCertificateName: to.Ptr(false), - // }, - // URL: to.Ptr("https://backendname2644/"), - // Protocol: to.Ptr(armapimanagement.BackendProtocolHTTP), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateBackendServiceFabric.json -func ExampleBackendClient_CreateOrUpdate_apiManagementCreateBackendServiceFabric() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackendClient().CreateOrUpdate(ctx, "rg1", "apimService1", "sfbackend", armapimanagement.BackendContract{ - Properties: &armapimanagement.BackendContractProperties{ - Description: to.Ptr("Service Fabric Test App 1"), - Properties: &armapimanagement.BackendProperties{ - ServiceFabricCluster: &armapimanagement.BackendServiceFabricClusterProperties{ - ClientCertificateID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1"), - ManagementEndpoints: []*string{ - to.Ptr("https://somecluster.com")}, - MaxPartitionResolutionRetries: to.Ptr[int32](5), - ServerX509Names: []*armapimanagement.X509CertificateName{ - { - Name: to.Ptr("ServerCommonName1"), - IssuerCertificateThumbprint: to.Ptr("IssuerCertificateThumbprint1"), - }}, - }, - }, - URL: to.Ptr("fabric:/mytestapp/mytestservice"), - Protocol: to.Ptr(armapimanagement.BackendProtocolHTTP), - }, - }, &armapimanagement.BackendClientCreateOrUpdateOptions{IfMatch: 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.BackendContract = armapimanagement.BackendContract{ - // Name: to.Ptr("sfbackend"), - // Type: to.Ptr("Microsoft.ApiManagement/service/backends"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/backends/sfbackend"), - // Properties: &armapimanagement.BackendContractProperties{ - // Description: to.Ptr("Service Fabric Test App 1"), - // Properties: &armapimanagement.BackendProperties{ - // ServiceFabricCluster: &armapimanagement.BackendServiceFabricClusterProperties{ - // ClientCertificateID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1"), - // ManagementEndpoints: []*string{ - // to.Ptr("https://somecluster.com")}, - // MaxPartitionResolutionRetries: to.Ptr[int32](5), - // ServerX509Names: []*armapimanagement.X509CertificateName{ - // { - // Name: to.Ptr("ServerCommonName1"), - // IssuerCertificateThumbprint: to.Ptr("IssuerCertificateThumbprint1"), - // }}, - // }, - // }, - // URL: to.Ptr("fabric:/mytestapp/mytestservice"), - // Protocol: to.Ptr(armapimanagement.BackendProtocolHTTP), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateBackend.json -func ExampleBackendClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackendClient().Update(ctx, "rg1", "apimService1", "proxybackend", "*", armapimanagement.BackendUpdateParameters{ - Properties: &armapimanagement.BackendUpdateParameterProperties{ - Description: to.Ptr("description5308"), - TLS: &armapimanagement.BackendTLSProperties{ - ValidateCertificateChain: to.Ptr(false), - ValidateCertificateName: to.Ptr(true), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackendContract = armapimanagement.BackendContract{ - // Name: to.Ptr("proxybackend"), - // Type: to.Ptr("Microsoft.ApiManagement/service/backends"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/backends/proxybackend"), - // Properties: &armapimanagement.BackendContractProperties{ - // Description: to.Ptr("description5308"), - // Credentials: &armapimanagement.BackendCredentialsContract{ - // Authorization: &armapimanagement.BackendAuthorizationHeaderCredentials{ - // Parameter: to.Ptr("opensesma"), - // Scheme: to.Ptr("Basic"), - // }, - // Header: map[string][]*string{ - // "x-my-1": []*string{ - // to.Ptr("val1"), - // to.Ptr("val2")}, - // }, - // Query: map[string][]*string{ - // "sv": []*string{ - // to.Ptr("xx"), - // to.Ptr("bb"), - // to.Ptr("cc")}, - // }, - // }, - // Proxy: &armapimanagement.BackendProxyContract{ - // Password: to.Ptr(""), - // URL: to.Ptr("http://192.168.1.1:8080"), - // Username: to.Ptr("Contoso\\admin"), - // }, - // TLS: &armapimanagement.BackendTLSProperties{ - // ValidateCertificateChain: to.Ptr(false), - // ValidateCertificateName: to.Ptr(true), - // }, - // URL: to.Ptr("https://backendname2644/"), - // Protocol: to.Ptr(armapimanagement.BackendProtocolHTTP), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteBackend.json -func ExampleBackendClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewBackendClient().Delete(ctx, "rg1", "apimService1", "sfbackend", "*", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementBackendReconnect.json -func ExampleBackendClient_Reconnect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewBackendClient().Reconnect(ctx, "rg1", "apimService1", "proxybackend", &armapimanagement.BackendClientReconnectOptions{Parameters: &armapimanagement.BackendReconnectContract{ - Properties: &armapimanagement.BackendReconnectProperties{ - After: to.Ptr("PT3S"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/cache_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/cache_client.go index 6bb3ca7877a8..0f1fe0deaa3c 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/cache_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/cache_client.go @@ -30,8 +30,7 @@ type CacheClient struct { } // NewCacheClient creates a new instance of CacheClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewCacheClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CacheClient, error) { @@ -49,8 +48,8 @@ func NewCacheClient(subscriptionID string, credential azcore.TokenCredential, op // CreateOrUpdate - Creates or updates an External Cache to be used in Api Management instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - cacheID - Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). // - parameters - Create or Update parameters. @@ -94,7 +93,7 @@ func (client *CacheClient) createOrUpdateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -118,8 +117,8 @@ func (client *CacheClient) createOrUpdateHandleResponse(resp *http.Response) (Ca // Delete - Deletes specific Cache. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - cacheID - Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -164,7 +163,7 @@ func (client *CacheClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -174,8 +173,8 @@ func (client *CacheClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Gets the details of the Cache specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - cacheID - Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). // - options - CacheClientGetOptions contains the optional parameters for the CacheClient.Get method. @@ -218,7 +217,7 @@ func (client *CacheClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -238,8 +237,8 @@ func (client *CacheClient) getHandleResponse(resp *http.Response) (CacheClientGe // GetEntityTag - Gets the entity state (Etag) version of the Cache specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - cacheID - Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). // - options - CacheClientGetEntityTagOptions contains the optional parameters for the CacheClient.GetEntityTag method. @@ -282,7 +281,7 @@ func (client *CacheClient) getEntityTagCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -300,8 +299,8 @@ func (client *CacheClient) getEntityTagHandleResponse(resp *http.Response) (Cach // NewListByServicePager - Lists a collection of all external Caches in the specified service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - CacheClientListByServiceOptions contains the optional parameters for the CacheClient.NewListByServicePager method. func (client *CacheClient) NewListByServicePager(resourceGroupName string, serviceName string, options *CacheClientListByServiceOptions) *runtime.Pager[CacheClientListByServiceResponse] { @@ -358,7 +357,7 @@ func (client *CacheClient) listByServiceCreateRequest(ctx context.Context, resou if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -376,8 +375,8 @@ func (client *CacheClient) listByServiceHandleResponse(resp *http.Response) (Cac // Update - Updates the details of the cache specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - cacheID - Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -423,7 +422,7 @@ func (client *CacheClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/cache_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/cache_client_example_test.go deleted file mode 100644 index adecf6ca9a86..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/cache_client_example_test.go +++ /dev/null @@ -1,199 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListCaches.json -func ExampleCacheClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCacheClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.CacheClientListByServiceOptions{Top: nil, - Skip: 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.CacheCollection = armapimanagement.CacheCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.CacheContract{ - // { - // Name: to.Ptr("c1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/caches"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/caches/c1"), - // Properties: &armapimanagement.CacheContractProperties{ - // Description: to.Ptr("Redis cache instances in West India"), - // ConnectionString: to.Ptr("{{5f7fbca77a891a2200f3db38}}"), - // ResourceID: to.Ptr("https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redis/apimservice1"), - // UseFromLocation: to.Ptr("default"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadCache.json -func ExampleCacheClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCacheClient().GetEntityTag(ctx, "rg1", "apimService1", "default", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCache.json -func ExampleCacheClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCacheClient().Get(ctx, "rg1", "apimService1", "c1", 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.CacheContract = armapimanagement.CacheContract{ - // Name: to.Ptr("c1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/caches"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/caches/c1"), - // Properties: &armapimanagement.CacheContractProperties{ - // Description: to.Ptr("Redis cache instances in West India"), - // ConnectionString: to.Ptr("{{5f7fbca77a891a2200f3db38}}"), - // ResourceID: to.Ptr("https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redis/apimservice1"), - // UseFromLocation: to.Ptr("default"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateCache.json -func ExampleCacheClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCacheClient().CreateOrUpdate(ctx, "rg1", "apimService1", "c1", armapimanagement.CacheContract{ - Properties: &armapimanagement.CacheContractProperties{ - Description: to.Ptr("Redis cache instances in West India"), - ConnectionString: to.Ptr("apim.redis.cache.windows.net:6380,password=xc,ssl=True,abortConnect=False"), - ResourceID: to.Ptr("https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redis/apimservice1"), - UseFromLocation: to.Ptr("default"), - }, - }, &armapimanagement.CacheClientCreateOrUpdateOptions{IfMatch: 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.CacheContract = armapimanagement.CacheContract{ - // Name: to.Ptr("c1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/caches"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/caches/c1"), - // Properties: &armapimanagement.CacheContractProperties{ - // Description: to.Ptr("Redis cache instances in West India"), - // ConnectionString: to.Ptr("{{5f7fbca77a891a2200f3db38}}"), - // ResourceID: to.Ptr("https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redis/apimservice1"), - // UseFromLocation: to.Ptr("default"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateCache.json -func ExampleCacheClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCacheClient().Update(ctx, "rg1", "apimService1", "c1", "*", armapimanagement.CacheUpdateParameters{ - Properties: &armapimanagement.CacheUpdateProperties{ - UseFromLocation: to.Ptr("westindia"), - }, - }, 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.CacheContract = armapimanagement.CacheContract{ - // Name: to.Ptr("c1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/caches"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/caches/c1"), - // Properties: &armapimanagement.CacheContractProperties{ - // Description: to.Ptr("Redis cache instances in West India"), - // ConnectionString: to.Ptr("{{5f7fbca77a891a2200f3db38}}"), - // ResourceID: to.Ptr("https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redis/apimservice1"), - // UseFromLocation: to.Ptr("westindia"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteCache.json -func ExampleCacheClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCacheClient().Delete(ctx, "rg1", "apimService1", "southindia", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/certificate_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/certificate_client.go index 4486b90ab0fc..4071053e89ef 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/certificate_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/certificate_client.go @@ -30,8 +30,7 @@ type CertificateClient struct { } // NewCertificateClient creates a new instance of CertificateClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewCertificateClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CertificateClient, error) { @@ -49,8 +48,8 @@ func NewCertificateClient(subscriptionID string, credential azcore.TokenCredenti // CreateOrUpdate - Creates or updates the certificate being used for authentication with the backend. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - certificateID - Identifier of the certificate entity. Must be unique in the current API Management service instance. // - parameters - Create or Update parameters. @@ -95,7 +94,7 @@ func (client *CertificateClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -119,8 +118,8 @@ func (client *CertificateClient) createOrUpdateHandleResponse(resp *http.Respons // Delete - Deletes specific certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - certificateID - Identifier of the certificate entity. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -165,7 +164,7 @@ func (client *CertificateClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -175,8 +174,8 @@ func (client *CertificateClient) deleteCreateRequest(ctx context.Context, resour // Get - Gets the details of the certificate specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - certificateID - Identifier of the certificate entity. Must be unique in the current API Management service instance. // - options - CertificateClientGetOptions contains the optional parameters for the CertificateClient.Get method. @@ -219,7 +218,7 @@ func (client *CertificateClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -239,8 +238,8 @@ func (client *CertificateClient) getHandleResponse(resp *http.Response) (Certifi // GetEntityTag - Gets the entity state (Etag) version of the certificate specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - certificateID - Identifier of the certificate entity. Must be unique in the current API Management service instance. // - options - CertificateClientGetEntityTagOptions contains the optional parameters for the CertificateClient.GetEntityTag @@ -284,7 +283,7 @@ func (client *CertificateClient) getEntityTagCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -302,8 +301,8 @@ func (client *CertificateClient) getEntityTagHandleResponse(resp *http.Response) // NewListByServicePager - Lists a collection of all certificates in the specified service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - CertificateClientListByServiceOptions contains the optional parameters for the CertificateClient.NewListByServicePager // method. @@ -367,7 +366,7 @@ func (client *CertificateClient) listByServiceCreateRequest(ctx context.Context, if options != nil && options.IsKeyVaultRefreshFailed != nil { reqQP.Set("isKeyVaultRefreshFailed", strconv.FormatBool(*options.IsKeyVaultRefreshFailed)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -385,8 +384,8 @@ func (client *CertificateClient) listByServiceHandleResponse(resp *http.Response // RefreshSecret - From KeyVault, Refresh the certificate being used for authentication with the backend. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - certificateID - Identifier of the certificate entity. Must be unique in the current API Management service instance. // - options - CertificateClientRefreshSecretOptions contains the optional parameters for the CertificateClient.RefreshSecret @@ -430,7 +429,7 @@ func (client *CertificateClient) refreshSecretCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/certificate_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/certificate_client_example_test.go deleted file mode 100644 index f206c3d2c305..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/certificate_client_example_test.go +++ /dev/null @@ -1,300 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListCertificates.json -func ExampleCertificateClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCertificateClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.CertificateClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: nil, - IsKeyVaultRefreshFailed: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CertificateCollection = armapimanagement.CertificateCollection{ - // Count: to.Ptr[int64](2), - // Value: []*armapimanagement.CertificateContract{ - // { - // Name: to.Ptr("templateCert1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/certificates"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/kjoshiarmtemplateCert1"), - // Properties: &armapimanagement.CertificateContractProperties{ - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-23T17:03:41Z"); return t}()), - // Subject: to.Ptr("CN=mutual-authcert"), - // Thumbprint: to.Ptr("EBA************************48594A6"), - // }, - // }, - // { - // Name: to.Ptr("templateCertkv"), - // Type: to.Ptr("Microsoft.ApiManagement/service/certificates"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/templateCertkv"), - // Properties: &armapimanagement.CertificateContractProperties{ - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2037-01-01T07:00:00Z"); return t}()), - // KeyVault: &armapimanagement.KeyVaultContractProperties{ - // IdentityClientID: to.Ptr("ceaa6b06-c00f-43ef-99ac-f53d1fe876a0"), - // SecretIdentifier: to.Ptr("https://rpbvtkeyvaultintegration.vault-int.azure-int.net/secrets/msitestingCert"), - // LastStatus: &armapimanagement.KeyVaultLastAccessStatusContractProperties{ - // Code: to.Ptr("Success"), - // TimeStampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-22T00:24:53.3191468Z"); return t}()), - // }, - // }, - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("EA**********************9AD690"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadCertificate.json -func ExampleCertificateClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCertificateClient().GetEntityTag(ctx, "rg1", "apimService1", "templateCert1", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCertificate.json -func ExampleCertificateClient_Get_apiManagementGetCertificate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificateClient().Get(ctx, "rg1", "apimService1", "templateCert1", 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.CertificateContract = armapimanagement.CertificateContract{ - // Name: to.Ptr("templateCert1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/certificates"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/templateCert1"), - // Properties: &armapimanagement.CertificateContractProperties{ - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-23T17:03:41Z"); return t}()), - // Subject: to.Ptr("CN=mutual-authcert"), - // Thumbprint: to.Ptr("EBA**********************8594A6"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCertificateWithKeyVault.json -func ExampleCertificateClient_Get_apiManagementGetCertificateWithKeyVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificateClient().Get(ctx, "rg1", "apimService1", "templateCertkv", 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.CertificateContract = armapimanagement.CertificateContract{ - // Name: to.Ptr("templateCertkv"), - // Type: to.Ptr("Microsoft.ApiManagement/service/certificates"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/templateCertkv"), - // Properties: &armapimanagement.CertificateContractProperties{ - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2037-01-01T07:00:00Z"); return t}()), - // KeyVault: &armapimanagement.KeyVaultContractProperties{ - // IdentityClientID: to.Ptr("ceaa6b06-c00f-43ef-99ac-f53d1fe876a0"), - // SecretIdentifier: to.Ptr("https://rpbvtkeyvaultintegration.vault-int.azure-int.net/secrets/msitestingCert"), - // LastStatus: &armapimanagement.KeyVaultLastAccessStatusContractProperties{ - // Code: to.Ptr("Success"), - // TimeStampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-22T00:24:53.3191468Z"); return t}()), - // }, - // }, - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("EA**********************9AD690"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateCertificate.json -func ExampleCertificateClient_CreateOrUpdate_apiManagementCreateCertificate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificateClient().CreateOrUpdate(ctx, "rg1", "apimService1", "tempcert", armapimanagement.CertificateCreateOrUpdateParameters{ - Properties: &armapimanagement.CertificateCreateOrUpdateProperties{ - Data: to.Ptr("****************Base 64 Encoded Certificate *******************************"), - Password: to.Ptr("****Certificate Password******"), - }, - }, &armapimanagement.CertificateClientCreateOrUpdateOptions{IfMatch: 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.CertificateContract = armapimanagement.CertificateContract{ - // Name: to.Ptr("tempcert"), - // Type: to.Ptr("Microsoft.ApiManagement/service/certificates"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/tempcert"), - // Properties: &armapimanagement.CertificateContractProperties{ - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-17T21:55:07+00:00"); return t}()), - // Subject: to.Ptr("CN=contoso.com"), - // Thumbprint: to.Ptr("*******************3"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateCertificateWithKeyVault.json -func ExampleCertificateClient_CreateOrUpdate_apiManagementCreateCertificateWithKeyVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificateClient().CreateOrUpdate(ctx, "rg1", "apimService1", "templateCertkv", armapimanagement.CertificateCreateOrUpdateParameters{ - Properties: &armapimanagement.CertificateCreateOrUpdateProperties{ - KeyVault: &armapimanagement.KeyVaultContractCreateProperties{ - IdentityClientID: to.Ptr("ceaa6b06-c00f-43ef-99ac-f53d1fe876a0"), - SecretIdentifier: to.Ptr("https://rpbvtkeyvaultintegration.vault-int.azure-int.net/secrets/msitestingCert"), - }, - }, - }, &armapimanagement.CertificateClientCreateOrUpdateOptions{IfMatch: 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.CertificateContract = armapimanagement.CertificateContract{ - // Name: to.Ptr("templateCertkv"), - // Type: to.Ptr("Microsoft.ApiManagement/service/certificates"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/templateCertkv"), - // Properties: &armapimanagement.CertificateContractProperties{ - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2037-01-01T07:00:00Z"); return t}()), - // KeyVault: &armapimanagement.KeyVaultContractProperties{ - // IdentityClientID: to.Ptr("ceaa6b06-c00f-43ef-99ac-f53d1fe876a0"), - // SecretIdentifier: to.Ptr("https://rpbvtkeyvaultintegration.vault-int.azure-int.net/secrets/msitestingCert"), - // LastStatus: &armapimanagement.KeyVaultLastAccessStatusContractProperties{ - // Code: to.Ptr("Success"), - // TimeStampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-22T00:24:53.3191468Z"); return t}()), - // }, - // }, - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("EA**********************9AD690"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteCertificate.json -func ExampleCertificateClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCertificateClient().Delete(ctx, "rg1", "apimService1", "tempcert", "*", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementRefreshCertificate.json -func ExampleCertificateClient_RefreshSecret() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificateClient().RefreshSecret(ctx, "rg1", "apimService1", "templateCertkv", 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.CertificateContract = armapimanagement.CertificateContract{ - // Name: to.Ptr("templateCertkv"), - // Type: to.Ptr("Microsoft.ApiManagement/service/certificates"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/templateCertkv"), - // Properties: &armapimanagement.CertificateContractProperties{ - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2037-01-01T07:00:00Z"); return t}()), - // KeyVault: &armapimanagement.KeyVaultContractProperties{ - // IdentityClientID: to.Ptr("ceaa6b06-c00f-43ef-99ac-f53d1fe876a0"), - // SecretIdentifier: to.Ptr("https://rpbvtkeyvaultintegration.vault-int.azure-int.net/secrets/msitestingCert"), - // LastStatus: &armapimanagement.KeyVaultLastAccessStatusContractProperties{ - // Code: to.Ptr("Success"), - // TimeStampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-22T00:24:53.3191468Z"); return t}()), - // }, - // }, - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("EA**********************9AD690"), - // }, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/client.go b/sdk/resourcemanager/apimanagement/armapimanagement/client.go index 52f289bf8026..69500672979f 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/client.go @@ -29,8 +29,7 @@ type Client struct { } // NewClient creates a new instance of Client with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { @@ -49,8 +48,8 @@ func NewClient(subscriptionID string, credential azcore.TokenCredential, options // and returns metrics for the connection, as well as errors encountered while trying to establish it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - connectivityCheckRequestParams - Connectivity Check request parameters. // - options - ClientBeginPerformConnectivityCheckAsyncOptions contains the optional parameters for the Client.BeginPerformConnectivityCheckAsync @@ -73,7 +72,7 @@ func (client *Client) BeginPerformConnectivityCheckAsync(ctx context.Context, re // and returns metrics for the connection, as well as errors encountered while trying to establish it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *Client) performConnectivityCheckAsync(ctx context.Context, resourceGroupName string, serviceName string, connectivityCheckRequestParams ConnectivityCheckRequest, options *ClientBeginPerformConnectivityCheckAsyncOptions) (*http.Response, error) { req, err := client.performConnectivityCheckAsyncCreateRequest(ctx, resourceGroupName, serviceName, connectivityCheckRequestParams, options) if err != nil { @@ -109,7 +108,7 @@ func (client *Client) performConnectivityCheckAsyncCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, connectivityCheckRequestParams) diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/client_example_test.go deleted file mode 100644 index 6216a2ff60a9..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/client_example_test.go +++ /dev/null @@ -1,154 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPerformConnectivityCheckHttpConnect.json -func ExampleClient_BeginPerformConnectivityCheckAsync_httpConnectivityCheck() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginPerformConnectivityCheckAsync(ctx, "rg1", "apimService1", armapimanagement.ConnectivityCheckRequest{ - Destination: &armapimanagement.ConnectivityCheckRequestDestination{ - Address: to.Ptr("https://microsoft.com"), - Port: to.Ptr[int64](3306), - }, - ProtocolConfiguration: &armapimanagement.ConnectivityCheckRequestProtocolConfiguration{ - HTTPConfiguration: &armapimanagement.ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration{ - Method: to.Ptr(armapimanagement.MethodGET), - Headers: []*armapimanagement.HTTPHeader{ - { - Name: to.Ptr("Authorization"), - Value: to.Ptr("Bearer myPreciousToken"), - }}, - ValidStatusCodes: []*int64{ - to.Ptr[int64](200), - to.Ptr[int64](204)}, - }, - }, - Source: &armapimanagement.ConnectivityCheckRequestSource{ - Region: to.Ptr("northeurope"), - }, - Protocol: to.Ptr(armapimanagement.ConnectivityCheckProtocolHTTPS), - }, 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.ConnectivityCheckResponse = armapimanagement.ConnectivityCheckResponse{ - // AvgLatencyInMs: to.Ptr[int64](260), - // ConnectionStatus: to.Ptr(armapimanagement.ConnectionStatus("Reachable")), - // Hops: []*armapimanagement.ConnectivityHop{ - // { - // Type: to.Ptr("Source"), - // Address: to.Ptr("20.82.216.48"), - // ID: to.Ptr("c60e2296-5ebc-48cc-80e8-7e6d2981e7b2"), - // Issues: []*armapimanagement.ConnectivityIssue{ - // }, - // NextHopIDs: []*string{ - // to.Ptr("26aa44e7-04f1-462f-aa5d-5951957b5650")}, - // ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // }, - // { - // Type: to.Ptr("Internet"), - // Address: to.Ptr("40.113.200.201"), - // ID: to.Ptr("26aa44e7-04f1-462f-aa5d-5951957b5650"), - // Issues: []*armapimanagement.ConnectivityIssue{ - // }, - // NextHopIDs: []*string{ - // }, - // }}, - // MaxLatencyInMs: to.Ptr[int64](281), - // MinLatencyInMs: to.Ptr[int64](250), - // ProbesFailed: to.Ptr[int64](0), - // ProbesSent: to.Ptr[int64](3), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPerformConnectivityCheck.json -func ExampleClient_BeginPerformConnectivityCheckAsync_tcpConnectivityCheck() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginPerformConnectivityCheckAsync(ctx, "rg1", "apimService1", armapimanagement.ConnectivityCheckRequest{ - Destination: &armapimanagement.ConnectivityCheckRequestDestination{ - Address: to.Ptr("8.8.8.8"), - Port: to.Ptr[int64](53), - }, - PreferredIPVersion: to.Ptr(armapimanagement.PreferredIPVersionIPv4), - Source: &armapimanagement.ConnectivityCheckRequestSource{ - Region: to.Ptr("northeurope"), - }, - }, 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.ConnectivityCheckResponse = armapimanagement.ConnectivityCheckResponse{ - // AvgLatencyInMs: to.Ptr[int64](1), - // ConnectionStatus: to.Ptr(armapimanagement.ConnectionStatusConnected), - // Hops: []*armapimanagement.ConnectivityHop{ - // { - // Type: to.Ptr("Source"), - // Address: to.Ptr("10.1.1.4"), - // ID: to.Ptr("7dbbe7aa-60ba-4650-831e-63d775d38e9e"), - // Issues: []*armapimanagement.ConnectivityIssue{ - // }, - // NextHopIDs: []*string{ - // to.Ptr("75c8d819-b208-4584-a311-1aa45ce753f9")}, - // ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // }, - // { - // Type: to.Ptr("Internet"), - // Address: to.Ptr("8.8.8.8"), - // ID: to.Ptr("75c8d819-b208-4584-a311-1aa45ce753f9"), - // Issues: []*armapimanagement.ConnectivityIssue{ - // }, - // NextHopIDs: []*string{ - // }, - // }}, - // MaxLatencyInMs: to.Ptr[int64](4), - // MinLatencyInMs: to.Ptr[int64](1), - // ProbesFailed: to.Ptr[int64](0), - // ProbesSent: to.Ptr[int64](100), - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/client_factory.go b/sdk/resourcemanager/apimanagement/armapimanagement/client_factory.go index b3570c576ab1..2c6842404a1f 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/client_factory.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/client_factory.go @@ -24,8 +24,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 - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { @@ -69,6 +68,16 @@ func (c *ClientFactory) NewTagClient() *TagClient { return subClient } +func (c *ClientFactory) NewGraphQLAPIResolverClient() *GraphQLAPIResolverClient { + subClient, _ := NewGraphQLAPIResolverClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewGraphQLAPIResolverPolicyClient() *GraphQLAPIResolverPolicyClient { + subClient, _ := NewGraphQLAPIResolverPolicyClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewAPIProductClient() *APIProductClient { subClient, _ := NewAPIProductClient(c.subscriptionID, c.credential, c.options) return subClient @@ -114,6 +123,16 @@ func (c *ClientFactory) NewOperationClient() *OperationClient { return subClient } +func (c *ClientFactory) NewAPIWikiClient() *APIWikiClient { + subClient, _ := NewAPIWikiClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAPIWikisClient() *APIWikisClient { + subClient, _ := NewAPIWikisClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewAPIExportClient() *APIExportClient { subClient, _ := NewAPIExportClient(c.subscriptionID, c.credential, c.options) return subClient @@ -124,6 +143,26 @@ func (c *ClientFactory) NewAPIVersionSetClient() *APIVersionSetClient { return subClient } +func (c *ClientFactory) NewAuthorizationProviderClient() *AuthorizationProviderClient { + subClient, _ := NewAuthorizationProviderClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAuthorizationClient() *AuthorizationClient { + subClient, _ := NewAuthorizationClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAuthorizationLoginLinksClient() *AuthorizationLoginLinksClient { + subClient, _ := NewAuthorizationLoginLinksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAuthorizationAccessPolicyClient() *AuthorizationAccessPolicyClient { + subClient, _ := NewAuthorizationAccessPolicyClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewAuthorizationServerClient() *AuthorizationServerClient { subClient, _ := NewAuthorizationServerClient(c.subscriptionID, c.credential, c.options) return subClient @@ -184,6 +223,11 @@ func (c *ClientFactory) NewDiagnosticClient() *DiagnosticClient { return subClient } +func (c *ClientFactory) NewDocumentationClient() *DocumentationClient { + subClient, _ := NewDocumentationClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewEmailTemplateClient() *EmailTemplateClient { subClient, _ := NewEmailTemplateClient(c.subscriptionID, c.credential, c.options) return subClient @@ -279,6 +323,16 @@ func (c *ClientFactory) NewPolicyDescriptionClient() *PolicyDescriptionClient { return subClient } +func (c *ClientFactory) NewPolicyFragmentClient() *PolicyFragmentClient { + subClient, _ := NewPolicyFragmentClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPortalConfigClient() *PortalConfigClient { + subClient, _ := NewPortalConfigClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewPortalRevisionClient() *PortalRevisionClient { subClient, _ := NewPortalRevisionClient(c.subscriptionID, c.credential, c.options) return subClient @@ -334,6 +388,26 @@ func (c *ClientFactory) NewProductPolicyClient() *ProductPolicyClient { return subClient } +func (c *ClientFactory) NewProductWikiClient() *ProductWikiClient { + subClient, _ := NewProductWikiClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewProductWikisClient() *ProductWikisClient { + subClient, _ := NewProductWikisClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewProductAPILinkClient() *ProductAPILinkClient { + subClient, _ := NewProductAPILinkClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewProductGroupLinkClient() *ProductGroupLinkClient { + subClient, _ := NewProductGroupLinkClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewQuotaByCounterKeysClient() *QuotaByCounterKeysClient { subClient, _ := NewQuotaByCounterKeysClient(c.subscriptionID, c.credential, c.options) return subClient @@ -379,6 +453,21 @@ func (c *ClientFactory) NewTagResourceClient() *TagResourceClient { return subClient } +func (c *ClientFactory) NewTagAPILinkClient() *TagAPILinkClient { + subClient, _ := NewTagAPILinkClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewTagOperationLinkClient() *TagOperationLinkClient { + subClient, _ := NewTagOperationLinkClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewTagProductLinkClient() *TagProductLinkClient { + subClient, _ := NewTagProductLinkClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewTenantAccessClient() *TenantAccessClient { subClient, _ := NewTenantAccessClient(c.subscriptionID, c.credential, c.options) return subClient @@ -418,3 +507,143 @@ func (c *ClientFactory) NewUserConfirmationPasswordClient() *UserConfirmationPas subClient, _ := NewUserConfirmationPasswordClient(c.subscriptionID, c.credential, c.options) return subClient } + +func (c *ClientFactory) NewWorkspaceClient() *WorkspaceClient { + subClient, _ := NewWorkspaceClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspacePolicyClient() *WorkspacePolicyClient { + subClient, _ := NewWorkspacePolicyClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceNamedValueClient() *WorkspaceNamedValueClient { + subClient, _ := NewWorkspaceNamedValueClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceGlobalSchemaClient() *WorkspaceGlobalSchemaClient { + subClient, _ := NewWorkspaceGlobalSchemaClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceNotificationClient() *WorkspaceNotificationClient { + subClient, _ := NewWorkspaceNotificationClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceNotificationRecipientUserClient() *WorkspaceNotificationRecipientUserClient { + subClient, _ := NewWorkspaceNotificationRecipientUserClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceNotificationRecipientEmailClient() *WorkspaceNotificationRecipientEmailClient { + subClient, _ := NewWorkspaceNotificationRecipientEmailClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspacePolicyFragmentClient() *WorkspacePolicyFragmentClient { + subClient, _ := NewWorkspacePolicyFragmentClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceGroupClient() *WorkspaceGroupClient { + subClient, _ := NewWorkspaceGroupClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceGroupUserClient() *WorkspaceGroupUserClient { + subClient, _ := NewWorkspaceGroupUserClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceSubscriptionClient() *WorkspaceSubscriptionClient { + subClient, _ := NewWorkspaceSubscriptionClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceAPIVersionSetClient() *WorkspaceAPIVersionSetClient { + subClient, _ := NewWorkspaceAPIVersionSetClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceAPIClient() *WorkspaceAPIClient { + subClient, _ := NewWorkspaceAPIClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceAPIRevisionClient() *WorkspaceAPIRevisionClient { + subClient, _ := NewWorkspaceAPIRevisionClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceAPIReleaseClient() *WorkspaceAPIReleaseClient { + subClient, _ := NewWorkspaceAPIReleaseClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceAPIOperationClient() *WorkspaceAPIOperationClient { + subClient, _ := NewWorkspaceAPIOperationClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceAPIOperationPolicyClient() *WorkspaceAPIOperationPolicyClient { + subClient, _ := NewWorkspaceAPIOperationPolicyClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceAPIPolicyClient() *WorkspaceAPIPolicyClient { + subClient, _ := NewWorkspaceAPIPolicyClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceAPISchemaClient() *WorkspaceAPISchemaClient { + subClient, _ := NewWorkspaceAPISchemaClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceProductClient() *WorkspaceProductClient { + subClient, _ := NewWorkspaceProductClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceProductAPILinkClient() *WorkspaceProductAPILinkClient { + subClient, _ := NewWorkspaceProductAPILinkClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceProductGroupLinkClient() *WorkspaceProductGroupLinkClient { + subClient, _ := NewWorkspaceProductGroupLinkClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceProductPolicyClient() *WorkspaceProductPolicyClient { + subClient, _ := NewWorkspaceProductPolicyClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceTagClient() *WorkspaceTagClient { + subClient, _ := NewWorkspaceTagClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceTagAPILinkClient() *WorkspaceTagAPILinkClient { + subClient, _ := NewWorkspaceTagAPILinkClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceTagOperationLinkClient() *WorkspaceTagOperationLinkClient { + subClient, _ := NewWorkspaceTagOperationLinkClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceTagProductLinkClient() *WorkspaceTagProductLinkClient { + subClient, _ := NewWorkspaceTagProductLinkClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspaceAPIExportClient() *WorkspaceAPIExportClient { + subClient, _ := NewWorkspaceAPIExportClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/constants.go b/sdk/resourcemanager/apimanagement/armapimanagement/constants.go index cc723d26d67d..941e304231f7 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/constants.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/constants.go @@ -11,7 +11,7 @@ package armapimanagement const ( moduleName = "armapimanagement" - moduleVersion = "v1.1.1" + moduleVersion = "v2.0.0-beta.1" ) // APIManagementSKUCapacityScaleType - The scale type applicable to the sku. @@ -70,6 +70,7 @@ type APIType string const ( APITypeGraphql APIType = "graphql" APITypeHTTP APIType = "http" + APITypeOData APIType = "odata" APITypeSoap APIType = "soap" APITypeWebsocket APIType = "websocket" ) @@ -79,6 +80,7 @@ func PossibleAPITypeValues() []APIType { return []APIType{ APITypeGraphql, APITypeHTTP, + APITypeOData, APITypeSoap, APITypeWebsocket, } @@ -89,8 +91,11 @@ func PossibleAPITypeValues() []APIType { type APIVersionSetContractDetailsVersioningScheme string const ( - APIVersionSetContractDetailsVersioningSchemeHeader APIVersionSetContractDetailsVersioningScheme = "Header" - APIVersionSetContractDetailsVersioningSchemeQuery APIVersionSetContractDetailsVersioningScheme = "Query" + // APIVersionSetContractDetailsVersioningSchemeHeader - The API Version is passed in a HTTP header. + APIVersionSetContractDetailsVersioningSchemeHeader APIVersionSetContractDetailsVersioningScheme = "Header" + // APIVersionSetContractDetailsVersioningSchemeQuery - The API Version is passed in a query parameter. + APIVersionSetContractDetailsVersioningSchemeQuery APIVersionSetContractDetailsVersioningScheme = "Query" + // APIVersionSetContractDetailsVersioningSchemeSegment - The API Version is passed in a path segment. APIVersionSetContractDetailsVersioningSchemeSegment APIVersionSetContractDetailsVersioningScheme = "Segment" ) @@ -213,6 +218,26 @@ func PossibleAsyncOperationStatusValues() []AsyncOperationStatus { } } +// AsyncResolverStatus - Status of an async resolver. +type AsyncResolverStatus string + +const ( + AsyncResolverStatusStarted AsyncResolverStatus = "Started" + AsyncResolverStatusInProgress AsyncResolverStatus = "InProgress" + AsyncResolverStatusSucceeded AsyncResolverStatus = "Succeeded" + AsyncResolverStatusFailed AsyncResolverStatus = "Failed" +) + +// PossibleAsyncResolverStatusValues returns the possible values for the AsyncResolverStatus const type. +func PossibleAsyncResolverStatusValues() []AsyncResolverStatus { + return []AsyncResolverStatus{ + AsyncResolverStatusStarted, + AsyncResolverStatusInProgress, + AsyncResolverStatusSucceeded, + AsyncResolverStatusFailed, + } +} + type AuthorizationMethod string const ( @@ -240,6 +265,21 @@ func PossibleAuthorizationMethodValues() []AuthorizationMethod { } } +// AuthorizationType - Authorization type options +type AuthorizationType string + +const ( + // AuthorizationTypeOAuth2 - OAuth2 authorization type + AuthorizationTypeOAuth2 AuthorizationType = "OAuth2" +) + +// PossibleAuthorizationTypeValues returns the possible values for the AuthorizationType const type. +func PossibleAuthorizationTypeValues() []AuthorizationType { + return []AuthorizationType{ + AuthorizationTypeOAuth2, + } +} + // BackendProtocol - Backend communication protocol. type BackendProtocol string @@ -452,12 +492,16 @@ func PossibleConnectivityStatusTypeValues() []ConnectivityStatusType { } } -// ContentFormat - Format of the Content in which the API is getting imported. +// ContentFormat - Format of the Content in which the API is getting imported. New formats can be added in the future type ContentFormat string const ( // ContentFormatGraphqlLink - The GraphQL API endpoint hosted on a publicly accessible internet address. ContentFormatGraphqlLink ContentFormat = "graphql-link" + // ContentFormatOData - The contents are inline and Content Type is a OData XML Document. + ContentFormatOData ContentFormat = "odata" + // ContentFormatODataLink - The OData metadata document hosted on a publicly accessible internet address. + ContentFormatODataLink ContentFormat = "odata-link" // ContentFormatOpenapi - The contents are inline and Content Type is a OpenAPI 3.0 YAML Document. ContentFormatOpenapi ContentFormat = "openapi" // ContentFormatOpenapiJSON - The contents are inline and Content Type is a OpenAPI 3.0 JSON Document. @@ -484,6 +528,8 @@ const ( func PossibleContentFormatValues() []ContentFormat { return []ContentFormat{ ContentFormatGraphqlLink, + ContentFormatOData, + ContentFormatODataLink, ContentFormatOpenapi, ContentFormatOpenapiJSON, ContentFormatOpenapiJSONLink, @@ -599,6 +645,21 @@ func PossibleExportResultFormatValues() []ExportResultFormat { } } +// GatewayListDebugCredentialsContractPurpose - Purpose of debug credential. +type GatewayListDebugCredentialsContractPurpose string + +const ( + // GatewayListDebugCredentialsContractPurposeTracing - The tracing purpose. + GatewayListDebugCredentialsContractPurposeTracing GatewayListDebugCredentialsContractPurpose = "tracing" +) + +// PossibleGatewayListDebugCredentialsContractPurposeValues returns the possible values for the GatewayListDebugCredentialsContractPurpose const type. +func PossibleGatewayListDebugCredentialsContractPurposeValues() []GatewayListDebugCredentialsContractPurpose { + return []GatewayListDebugCredentialsContractPurpose{ + GatewayListDebugCredentialsContractPurposeTracing, + } +} + type GrantType string const ( @@ -665,16 +726,18 @@ func PossibleHTTPCorrelationProtocolValues() []HTTPCorrelationProtocol { type HostnameType string const ( - HostnameTypeDeveloperPortal HostnameType = "DeveloperPortal" - HostnameTypeManagement HostnameType = "Management" - HostnameTypePortal HostnameType = "Portal" - HostnameTypeProxy HostnameType = "Proxy" - HostnameTypeScm HostnameType = "Scm" + HostnameTypeConfigurationAPI HostnameType = "ConfigurationApi" + HostnameTypeDeveloperPortal HostnameType = "DeveloperPortal" + HostnameTypeManagement HostnameType = "Management" + HostnameTypePortal HostnameType = "Portal" + HostnameTypeProxy HostnameType = "Proxy" + HostnameTypeScm HostnameType = "Scm" ) // PossibleHostnameTypeValues returns the possible values for the HostnameType const type. func PossibleHostnameTypeValues() []HostnameType { return []HostnameType{ + HostnameTypeConfigurationAPI, HostnameTypeDeveloperPortal, HostnameTypeManagement, HostnameTypePortal, @@ -758,6 +821,45 @@ func PossibleKeyTypeValues() []KeyType { } } +type KeyVaultRefreshState string + +const ( + // KeyVaultRefreshStateFalse - Entities for which KeyVault refresh succeeded + KeyVaultRefreshStateFalse KeyVaultRefreshState = "false" + // KeyVaultRefreshStateTrue - Entities for which KeyVault refresh failed. + KeyVaultRefreshStateTrue KeyVaultRefreshState = "true" +) + +// PossibleKeyVaultRefreshStateValues returns the possible values for the KeyVaultRefreshState const type. +func PossibleKeyVaultRefreshStateValues() []KeyVaultRefreshState { + return []KeyVaultRefreshState{ + KeyVaultRefreshStateFalse, + KeyVaultRefreshStateTrue, + } +} + +// LegacyAPIState - Indication whether or not the legacy Configuration API (v1) should be exposed on the API Management service. +// Value is optional but must be 'Enabled' or 'Disabled'. If 'Disabled', legacy Configuration +// API (v1) will not be available for self-hosted gateways. Default value is 'Enabled' +type LegacyAPIState string + +const ( + // LegacyAPIStateDisabled - Legacy Configuration API (v1) is disabled for the service and self-hosted gateways can not connect + // to it. + LegacyAPIStateDisabled LegacyAPIState = "Disabled" + // LegacyAPIStateEnabled - Legacy Configuration API (v1) is enabled for the service and self-hosted gateways can connect to + // it. + LegacyAPIStateEnabled LegacyAPIState = "Enabled" +) + +// PossibleLegacyAPIStateValues returns the possible values for the LegacyAPIState const type. +func PossibleLegacyAPIStateValues() []LegacyAPIState { + return []LegacyAPIState{ + LegacyAPIStateDisabled, + LegacyAPIStateEnabled, + } +} + // LoggerType - Logger type. type LoggerType string @@ -795,6 +897,26 @@ func PossibleMethodValues() []Method { } } +// MigrateToStv2Mode - Mode of Migration to stv2. Default is PreserveIp. +type MigrateToStv2Mode string + +const ( + // MigrateToStv2ModeNewIP - Migrate API Management service to stv2 from stv1. This will have no downtime as the service configuration + // will be migrated to new infrastructure, but the IP address will changed. + MigrateToStv2ModeNewIP MigrateToStv2Mode = "NewIP" + // MigrateToStv2ModePreserveIP - Migrate API Management service to stv2 from stv1, by reserving the IP Address of the service. + // This will have a downtime of upto 15 minutes, while the IP address is getting migrate to new infrastructure. + MigrateToStv2ModePreserveIP MigrateToStv2Mode = "PreserveIp" +) + +// PossibleMigrateToStv2ModeValues returns the possible values for the MigrateToStv2Mode const type. +func PossibleMigrateToStv2ModeValues() []MigrateToStv2Mode { + return []MigrateToStv2Mode{ + MigrateToStv2ModeNewIP, + MigrateToStv2ModePreserveIP, + } +} + // NameAvailabilityReason - Invalid indicates the name provided does not match the resource provider’s naming requirements // (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is already in use // and is therefore unavailable. @@ -815,6 +937,24 @@ func PossibleNameAvailabilityReasonValues() []NameAvailabilityReason { } } +// NatGatewayState - Property can be used to enable NAT Gateway for this API Management service. +type NatGatewayState string + +const ( + // NatGatewayStateDisabled - Nat Gateway is disabled for the service. + NatGatewayStateDisabled NatGatewayState = "Disabled" + // NatGatewayStateEnabled - Nat Gateway is enabled for the service. + NatGatewayStateEnabled NatGatewayState = "Enabled" +) + +// PossibleNatGatewayStateValues returns the possible values for the NatGatewayState const type. +func PossibleNatGatewayStateValues() []NatGatewayState { + return []NatGatewayState{ + NatGatewayStateDisabled, + NatGatewayStateEnabled, + } +} + type NotificationName string const ( @@ -853,6 +993,24 @@ func PossibleNotificationNameValues() []NotificationName { } } +// OAuth2GrantType - OAuth2 grant type options +type OAuth2GrantType string + +const ( + // OAuth2GrantTypeAuthorizationCode - Authorization Code grant + OAuth2GrantTypeAuthorizationCode OAuth2GrantType = "AuthorizationCode" + // OAuth2GrantTypeClientCredentials - Client Credential grant + OAuth2GrantTypeClientCredentials OAuth2GrantType = "ClientCredentials" +) + +// PossibleOAuth2GrantTypeValues returns the possible values for the OAuth2GrantType const type. +func PossibleOAuth2GrantTypeValues() []OAuth2GrantType { + return []OAuth2GrantType{ + OAuth2GrantTypeAuthorizationCode, + OAuth2GrantTypeClientCredentials, + } +} + // OperationNameFormat - The format of the Operation Name for Application Insights telemetries. Default is Name. type OperationNameFormat string @@ -899,6 +1057,8 @@ const ( PlatformVersionStv1 PlatformVersion = "stv1" // PlatformVersionStv2 - Platform running the service on Single Tenant V2 platform. PlatformVersionStv2 PlatformVersion = "stv2" + // PlatformVersionStv21 - Platform running the service on Single Tenant V2 platform on newer Hardware. + PlatformVersionStv21 PlatformVersion = "stv2.1" // PlatformVersionUndetermined - Platform version cannot be determined, as compute platform is not deployed. PlatformVersionUndetermined PlatformVersion = "undetermined" ) @@ -909,6 +1069,7 @@ func PossiblePlatformVersionValues() []PlatformVersion { PlatformVersionMtv1, PlatformVersionStv1, PlatformVersionStv2, + PlatformVersionStv21, PlatformVersionUndetermined, } } @@ -919,12 +1080,12 @@ type PolicyContentFormat string const ( // PolicyContentFormatRawxml - The contents are inline and Content type is a non XML encoded policy document. PolicyContentFormatRawxml PolicyContentFormat = "rawxml" - // PolicyContentFormatRawxmlLink - The policy document is not Xml encoded and is hosted on a http endpoint accessible from + // PolicyContentFormatRawxmlLink - The policy document is not XML encoded and is hosted on a HTTP endpoint accessible from // the API Management service. PolicyContentFormatRawxmlLink PolicyContentFormat = "rawxml-link" // PolicyContentFormatXML - The contents are inline and Content type is an XML document. PolicyContentFormatXML PolicyContentFormat = "xml" - // PolicyContentFormatXMLLink - The policy XML document is hosted on a http endpoint accessible from the API Management service. + // PolicyContentFormatXMLLink - The policy XML document is hosted on a HTTP endpoint accessible from the API Management service. PolicyContentFormatXMLLink PolicyContentFormat = "xml-link" ) @@ -955,6 +1116,23 @@ func PossiblePolicyExportFormatValues() []PolicyExportFormat { } } +type PolicyFragmentContentFormat string + +const ( + // PolicyFragmentContentFormatRawxml - The contents are inline and Content type is a non XML encoded policy document. + PolicyFragmentContentFormatRawxml PolicyFragmentContentFormat = "rawxml" + // PolicyFragmentContentFormatXML - The contents are inline and Content type is an XML document. + PolicyFragmentContentFormatXML PolicyFragmentContentFormat = "xml" +) + +// PossiblePolicyFragmentContentFormatValues returns the possible values for the PolicyFragmentContentFormat const type. +func PossiblePolicyFragmentContentFormatValues() []PolicyFragmentContentFormat { + return []PolicyFragmentContentFormat{ + PolicyFragmentContentFormatRawxml, + PolicyFragmentContentFormatXML, + } +} + type PolicyIDName string const ( @@ -1013,6 +1191,27 @@ func PossiblePortalRevisionStatusValues() []PortalRevisionStatus { } } +// PortalSettingsCspMode - The mode of the developer portal Content Security Policy (CSP). +type PortalSettingsCspMode string + +const ( + // PortalSettingsCspModeDisabled - The browser will not apply the origin restrictions. + PortalSettingsCspModeDisabled PortalSettingsCspMode = "disabled" + // PortalSettingsCspModeEnabled - The browser will block requests not matching allowed origins. + PortalSettingsCspModeEnabled PortalSettingsCspMode = "enabled" + // PortalSettingsCspModeReportOnly - The browser will report requests not matching allowed origins without blocking them. + PortalSettingsCspModeReportOnly PortalSettingsCspMode = "reportOnly" +) + +// PossiblePortalSettingsCspModeValues returns the possible values for the PortalSettingsCspMode const type. +func PossiblePortalSettingsCspModeValues() []PortalSettingsCspMode { + return []PortalSettingsCspMode{ + PortalSettingsCspModeDisabled, + PortalSettingsCspModeEnabled, + PortalSettingsCspModeReportOnly, + } +} + // PreferredIPVersion - The IP version to be used. Only IPv4 is supported for now. type PreferredIPVersion string @@ -1192,7 +1391,7 @@ type SchemaType string const ( // SchemaTypeJSON - Json schema type. SchemaTypeJSON SchemaType = "json" - // SchemaTypeXML - Xml schema type. + // SchemaTypeXML - XML schema type. SchemaTypeXML SchemaType = "xml" ) @@ -1237,12 +1436,14 @@ func PossibleSeverityValues() []Severity { // * http creates a REST API // * soap creates a SOAP pass-through API // * websocket creates websocket API -// * graphql creates GraphQL API. +// * graphql creates GraphQL API. New types can be added in the future. type SoapAPIType string const ( // SoapAPITypeGraphQL - Imports the API having a GraphQL front end. SoapAPITypeGraphQL SoapAPIType = "graphql" + // SoapAPITypeOData - Imports the API having a OData front end. + SoapAPITypeOData SoapAPIType = "odata" // SoapAPITypeSoapPassThrough - Imports the SOAP API having a SOAP front end. SoapAPITypeSoapPassThrough SoapAPIType = "soap" // SoapAPITypeSoapToRest - Imports a SOAP API having a RESTful front end. @@ -1255,6 +1456,7 @@ const ( func PossibleSoapAPITypeValues() []SoapAPIType { return []SoapAPIType{ SoapAPITypeGraphQL, + SoapAPITypeOData, SoapAPITypeSoapPassThrough, SoapAPITypeSoapToRest, SoapAPITypeWebSocket, @@ -1356,6 +1558,25 @@ func PossibleTemplateNameValues() []TemplateName { } } +// TranslateRequiredQueryParametersConduct - Strategy of translating required query parameters to template ones. By default +// has value 'template'. Possible values: 'template', 'query' +type TranslateRequiredQueryParametersConduct string + +const ( + // TranslateRequiredQueryParametersConductQuery - Leaves required query parameters as they are (no translation done). + TranslateRequiredQueryParametersConductQuery TranslateRequiredQueryParametersConduct = "query" + // TranslateRequiredQueryParametersConductTemplate - Translates required query parameters to template ones. Is a default value + TranslateRequiredQueryParametersConductTemplate TranslateRequiredQueryParametersConduct = "template" +) + +// PossibleTranslateRequiredQueryParametersConductValues returns the possible values for the TranslateRequiredQueryParametersConduct const type. +func PossibleTranslateRequiredQueryParametersConductValues() []TranslateRequiredQueryParametersConduct { + return []TranslateRequiredQueryParametersConduct{ + TranslateRequiredQueryParametersConductQuery, + TranslateRequiredQueryParametersConductTemplate, + } +} + // UserState - Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer // portal or call any APIs of subscribed products. Default state is Active. type UserState string diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/contentitem_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/contentitem_client.go index dda05a01863b..14154d10c8dc 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/contentitem_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/contentitem_client.go @@ -29,8 +29,7 @@ type ContentItemClient struct { } // NewContentItemClient creates a new instance of ContentItemClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewContentItemClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContentItemClient, error) { @@ -48,15 +47,16 @@ func NewContentItemClient(subscriptionID string, credential azcore.TokenCredenti // CreateOrUpdate - Creates a new developer portal's content item specified by the provided content type. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - contentTypeID - Content type identifier. // - contentItemID - Content item identifier. +// - parameters - Create or update parameters. // - options - ContentItemClientCreateOrUpdateOptions contains the optional parameters for the ContentItemClient.CreateOrUpdate // method. -func (client *ContentItemClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, contentItemID string, options *ContentItemClientCreateOrUpdateOptions) (ContentItemClientCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, contentTypeID, contentItemID, options) +func (client *ContentItemClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, contentItemID string, parameters ContentItemContract, options *ContentItemClientCreateOrUpdateOptions) (ContentItemClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, contentTypeID, contentItemID, parameters, options) if err != nil { return ContentItemClientCreateOrUpdateResponse{}, err } @@ -71,7 +71,7 @@ func (client *ContentItemClient) CreateOrUpdate(ctx context.Context, resourceGro } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ContentItemClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, contentItemID string, options *ContentItemClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ContentItemClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, contentItemID string, parameters ContentItemContract, options *ContentItemClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -98,13 +98,13 @@ func (client *ContentItemClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil + return req, runtime.MarshalAsJSON(req, parameters) } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -122,8 +122,8 @@ func (client *ContentItemClient) createOrUpdateHandleResponse(resp *http.Respons // Delete - Removes the specified developer portal's content item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - contentTypeID - Content type identifier. // - contentItemID - Content item identifier. @@ -173,7 +173,7 @@ func (client *ContentItemClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -183,8 +183,8 @@ func (client *ContentItemClient) deleteCreateRequest(ctx context.Context, resour // Get - Returns the developer portal's content item specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - contentTypeID - Content type identifier. // - contentItemID - Content item identifier. @@ -232,7 +232,7 @@ func (client *ContentItemClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,8 +252,8 @@ func (client *ContentItemClient) getHandleResponse(resp *http.Response) (Content // GetEntityTag - Returns the entity state (ETag) version of the developer portal's content item specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - contentTypeID - Content type identifier. // - contentItemID - Content item identifier. @@ -302,7 +302,7 @@ func (client *ContentItemClient) getEntityTagCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -320,8 +320,8 @@ func (client *ContentItemClient) getEntityTagHandleResponse(resp *http.Response) // NewListByServicePager - Lists developer portal's content items specified by the provided content type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - contentTypeID - Content type identifier. // - options - ContentItemClientListByServiceOptions contains the optional parameters for the ContentItemClient.NewListByServicePager @@ -378,7 +378,7 @@ func (client *ContentItemClient) listByServiceCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/contentitem_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/contentitem_client_example_test.go deleted file mode 100644 index bd06584698bd..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/contentitem_client_example_test.go +++ /dev/null @@ -1,162 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListContentTypeContentItems.json -func ExampleContentItemClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewContentItemClient().NewListByServicePager("rg1", "apimService1", "page", 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.ContentItemCollection = armapimanagement.ContentItemCollection{ - // Value: []*armapimanagement.ContentItemContract{ - // { - // Name: to.Ptr("4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8"), - // Type: to.Ptr("Microsoft.ApiManagement/service/contentTypes/contentItems"), - // ID: to.Ptr("/contentTypes/page/contentItems/4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8"), - // Properties: map[string]any{ - // "en_us": map[string]any{ - // "description": "Short story about the company.", - // "documentId": "contentTypes/document/contentItems/4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8", - // "keywords": "company, about", - // "permalink": "/about", - // "title": "About", - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadContentTypeContentItem.json -func ExampleContentItemClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewContentItemClient().GetEntityTag(ctx, "rg1", "apimService1", "page", "4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetContentTypeContentItem.json -func ExampleContentItemClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewContentItemClient().Get(ctx, "rg1", "apimService1", "page", "4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8", 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.ContentItemContract = armapimanagement.ContentItemContract{ - // Name: to.Ptr("4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8"), - // Type: to.Ptr("Microsoft.ApiManagement/service/contentTypes/contentItems"), - // ID: to.Ptr("/contentTypes/page/contentItems/4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8"), - // Properties: map[string]any{ - // "en_us": map[string]any{ - // "description": "Short story about the company.", - // "documentId": "contentTypes/document/contentItems/4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8", - // "keywords": "company, about", - // "permalink": "/about", - // "title": "About", - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateContentTypeContentItem.json -func ExampleContentItemClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewContentItemClient().CreateOrUpdate(ctx, "rg1", "apimService1", "page", "4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8", &armapimanagement.ContentItemClientCreateOrUpdateOptions{IfMatch: 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.ContentItemContract = armapimanagement.ContentItemContract{ - // Name: to.Ptr("4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8"), - // Type: to.Ptr("Microsoft.ApiManagement/service/contentTypes/contentItems"), - // ID: to.Ptr("/contentTypes/page/contentItems/4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8"), - // Properties: map[string]any{ - // "en_us": map[string]any{ - // "description": "Short story about the company.", - // "documentId": "contentTypes/document/contentItems/4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8", - // "keywords": "company, about", - // "permalink": "/about", - // "title": "About", - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteContentTypeContentItem.json -func ExampleContentItemClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewContentItemClient().Delete(ctx, "rg1", "apimService1", "page", "4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/contenttype_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/contenttype_client.go index 5b29d4ef419e..bac3d79f1269 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/contenttype_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/contenttype_client.go @@ -29,8 +29,7 @@ type ContentTypeClient struct { } // NewContentTypeClient creates a new instance of ContentTypeClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewContentTypeClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContentTypeClient, error) { @@ -50,14 +49,15 @@ func NewContentTypeClient(subscriptionID string, credential azcore.TokenCredenti // prefix. Built-in content types can't be modified. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - contentTypeID - Content type identifier. +// - parameters - Create or update parameters. // - options - ContentTypeClientCreateOrUpdateOptions contains the optional parameters for the ContentTypeClient.CreateOrUpdate // method. -func (client *ContentTypeClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, options *ContentTypeClientCreateOrUpdateOptions) (ContentTypeClientCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, contentTypeID, options) +func (client *ContentTypeClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, parameters ContentTypeContract, options *ContentTypeClientCreateOrUpdateOptions) (ContentTypeClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, contentTypeID, parameters, options) if err != nil { return ContentTypeClientCreateOrUpdateResponse{}, err } @@ -72,7 +72,7 @@ func (client *ContentTypeClient) CreateOrUpdate(ctx context.Context, resourceGro } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ContentTypeClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, options *ContentTypeClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ContentTypeClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, parameters ContentTypeContract, options *ContentTypeClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -95,13 +95,13 @@ func (client *ContentTypeClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil + return req, runtime.MarshalAsJSON(req, parameters) } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -121,8 +121,8 @@ func (client *ContentTypeClient) createOrUpdateHandleResponse(resp *http.Respons // c- prefix) can't be removed. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - contentTypeID - Content type identifier. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -167,7 +167,7 @@ func (client *ContentTypeClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -178,8 +178,8 @@ func (client *ContentTypeClient) deleteCreateRequest(ctx context.Context, resour // rules, and constraints. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - contentTypeID - Content type identifier. // - options - ContentTypeClientGetOptions contains the optional parameters for the ContentTypeClient.Get method. @@ -222,7 +222,7 @@ func (client *ContentTypeClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -243,8 +243,8 @@ func (client *ContentTypeClient) getHandleResponse(resp *http.Response) (Content // NewListByServicePager - Lists the developer portal's content types. Content types describe content items' properties, validation // rules, and constraints. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - ContentTypeClientListByServiceOptions contains the optional parameters for the ContentTypeClient.NewListByServicePager // method. @@ -296,7 +296,7 @@ func (client *ContentTypeClient) listByServiceCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/contenttype_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/contenttype_client_example_test.go deleted file mode 100644 index 57a72218213d..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/contenttype_client_example_test.go +++ /dev/null @@ -1,268 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListContentTypes.json -func ExampleContentTypeClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewContentTypeClient().NewListByServicePager("rg1", "apimService1", 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.ContentTypeCollection = armapimanagement.ContentTypeCollection{ - // Value: []*armapimanagement.ContentTypeContract{ - // { - // Name: to.Ptr("page"), - // Type: to.Ptr("Microsoft.ApiManagement/service/contentTypes"), - // ID: to.Ptr("/contentTypes/page"), - // Properties: &armapimanagement.ContentTypeContractProperties{ - // Name: to.Ptr("Page"), - // Schema: map[string]any{ - // "additionalProperties": false, - // "properties":map[string]any{ - // "en_us":map[string]any{ - // "type": "object", - // "additionalProperties": false, - // "properties":map[string]any{ - // "description":map[string]any{ - // "type": "string", - // "description": "Page description. This property gets included in SEO attributes.", - // "indexed": true, - // "title": "Description", - // }, - // "documentId":map[string]any{ - // "type": "string", - // "description": "Reference to page content document.", - // "title": "Document ID", - // }, - // "keywords":map[string]any{ - // "type": "string", - // "description": "Page keywords. This property gets included in SEO attributes.", - // "indexed": true, - // "title": "Keywords", - // }, - // "permalink":map[string]any{ - // "type": "string", - // "description": "Page permalink, e.g. '/about'.", - // "indexed": true, - // "title": "Permalink", - // }, - // "title":map[string]any{ - // "type": "string", - // "description": "Page title. This property gets included in SEO attributes.", - // "indexed": true, - // "title": "Title", - // }, - // }, - // "required":[]any{ - // "title", - // "permalink", - // "documentId", - // }, - // }, - // }, - // }, - // Description: to.Ptr("A regular page"), - // Version: to.Ptr("1.0.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetContentType.json -func ExampleContentTypeClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewContentTypeClient().Get(ctx, "rg1", "apimService1", "page", 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.ContentTypeContract = armapimanagement.ContentTypeContract{ - // Name: to.Ptr("page"), - // Type: to.Ptr("Microsoft.ApiManagement/service/contentTypes"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/contentTypes/page"), - // Properties: &armapimanagement.ContentTypeContractProperties{ - // Name: to.Ptr("Page"), - // Schema: map[string]any{ - // "additionalProperties": false, - // "properties":map[string]any{ - // "en_us":map[string]any{ - // "type": "object", - // "additionalProperties": false, - // "properties":map[string]any{ - // "description":map[string]any{ - // "type": "string", - // "description": "Page description. This property gets included in SEO attributes.", - // "indexed": true, - // "title": "Description", - // }, - // "documentId":map[string]any{ - // "type": "string", - // "description": "Reference to page content document.", - // "title": "Document ID", - // }, - // "keywords":map[string]any{ - // "type": "string", - // "description": "Page keywords. This property gets included in SEO attributes.", - // "indexed": true, - // "title": "Keywords", - // }, - // "permalink":map[string]any{ - // "type": "string", - // "description": "Page permalink, e.g. '/about'.", - // "indexed": true, - // "title": "Permalink", - // }, - // "title":map[string]any{ - // "type": "string", - // "description": "Page title. This property gets included in SEO attributes.", - // "indexed": true, - // "title": "Title", - // }, - // }, - // "required":[]any{ - // "title", - // "permalink", - // "documentId", - // }, - // }, - // }, - // }, - // Description: to.Ptr("A regular page"), - // Version: to.Ptr("1.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateContentType.json -func ExampleContentTypeClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewContentTypeClient().CreateOrUpdate(ctx, "rg1", "apimService1", "page", &armapimanagement.ContentTypeClientCreateOrUpdateOptions{IfMatch: 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.ContentTypeContract = armapimanagement.ContentTypeContract{ - // Name: to.Ptr("page"), - // Type: to.Ptr("Microsoft.ApiManagement/service/contentTypes"), - // ID: to.Ptr("/contentTypes/page"), - // Properties: &armapimanagement.ContentTypeContractProperties{ - // Name: to.Ptr("Page"), - // Schema: map[string]any{ - // "additionalProperties": false, - // "properties":map[string]any{ - // "en_us":map[string]any{ - // "type": "object", - // "additionalProperties": false, - // "properties":map[string]any{ - // "description":map[string]any{ - // "type": "string", - // "description": "Page description. This property gets included in SEO attributes.", - // "indexed": true, - // "title": "Description", - // }, - // "documentId":map[string]any{ - // "type": "string", - // "description": "Reference to page content document.", - // "title": "Document ID", - // }, - // "keywords":map[string]any{ - // "type": "string", - // "description": "Page keywords. This property gets included in SEO attributes.", - // "indexed": true, - // "title": "Keywords", - // }, - // "permalink":map[string]any{ - // "type": "string", - // "description": "Page permalink, e.g. '/about'.", - // "indexed": true, - // "title": "Permalink", - // }, - // "title":map[string]any{ - // "type": "string", - // "description": "Page title. This property gets included in SEO attributes.", - // "indexed": true, - // "title": "Title", - // }, - // }, - // "required":[]any{ - // "title", - // "permalink", - // "documentId", - // }, - // }, - // }, - // }, - // Description: to.Ptr("A regular page"), - // Version: to.Ptr("1.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteContentType.json -func ExampleContentTypeClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewContentTypeClient().Delete(ctx, "rg1", "apimService1", "page", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/delegationsettings_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/delegationsettings_client.go index dcb54f63916d..72c1298783ae 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/delegationsettings_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/delegationsettings_client.go @@ -29,8 +29,7 @@ type DelegationSettingsClient struct { } // NewDelegationSettingsClient creates a new instance of DelegationSettingsClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDelegationSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DelegationSettingsClient, error) { @@ -48,8 +47,8 @@ func NewDelegationSettingsClient(subscriptionID string, credential azcore.TokenC // CreateOrUpdate - Create or Update Delegation settings. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - parameters - Create or update parameters. // - options - DelegationSettingsClientCreateOrUpdateOptions contains the optional parameters for the DelegationSettingsClient.CreateOrUpdate @@ -89,7 +88,7 @@ func (client *DelegationSettingsClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -110,8 +109,8 @@ func (client *DelegationSettingsClient) createOrUpdateHandleResponse(resp *http. // Get - Get Delegation Settings for the Portal. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - DelegationSettingsClientGetOptions contains the optional parameters for the DelegationSettingsClient.Get method. func (client *DelegationSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, options *DelegationSettingsClientGetOptions) (DelegationSettingsClientGetResponse, error) { @@ -149,7 +148,7 @@ func (client *DelegationSettingsClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -169,8 +168,8 @@ func (client *DelegationSettingsClient) getHandleResponse(resp *http.Response) ( // GetEntityTag - Gets the entity state (Etag) version of the DelegationSettings. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - DelegationSettingsClientGetEntityTagOptions contains the optional parameters for the DelegationSettingsClient.GetEntityTag // method. @@ -209,7 +208,7 @@ func (client *DelegationSettingsClient) getEntityTagCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,8 +227,8 @@ func (client *DelegationSettingsClient) getEntityTagHandleResponse(resp *http.Re // ListSecrets - Gets the secret validation key of the DelegationSettings. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - DelegationSettingsClientListSecretsOptions contains the optional parameters for the DelegationSettingsClient.ListSecrets // method. @@ -268,7 +267,7 @@ func (client *DelegationSettingsClient) listSecretsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -286,8 +285,8 @@ func (client *DelegationSettingsClient) listSecretsHandleResponse(resp *http.Res // Update - Update Delegation settings. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or // it should be * for unconditional update. @@ -329,7 +328,7 @@ func (client *DelegationSettingsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/delegationsettings_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/delegationsettings_client_example_test.go deleted file mode 100644 index 6e0ba8d6b537..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/delegationsettings_client_example_test.go +++ /dev/null @@ -1,166 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadDelegationSettings.json -func ExampleDelegationSettingsClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDelegationSettingsClient().GetEntityTag(ctx, "rg1", "apimService1", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsGetDelegation.json -func ExampleDelegationSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDelegationSettingsClient().Get(ctx, "rg1", "apimService1", 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.PortalDelegationSettings = armapimanagement.PortalDelegationSettings{ - // Name: to.Ptr("delegation"), - // Type: to.Ptr("Microsoft.ApiManagement/service/portalsettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/portalsettings/delegation"), - // Properties: &armapimanagement.PortalDelegationSettingsProperties{ - // Subscriptions: &armapimanagement.SubscriptionsDelegationSettingsProperties{ - // Enabled: to.Ptr(true), - // }, - // URL: to.Ptr("http://contoso.com/delegation"), - // UserRegistration: &armapimanagement.RegistrationDelegationSettingsProperties{ - // Enabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsUpdateDelegation.json -func ExampleDelegationSettingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDelegationSettingsClient().Update(ctx, "rg1", "apimService1", "*", armapimanagement.PortalDelegationSettings{ - Properties: &armapimanagement.PortalDelegationSettingsProperties{ - Subscriptions: &armapimanagement.SubscriptionsDelegationSettingsProperties{ - Enabled: to.Ptr(true), - }, - URL: to.Ptr("http://contoso.com/delegation"), - UserRegistration: &armapimanagement.RegistrationDelegationSettingsProperties{ - Enabled: to.Ptr(true), - }, - ValidationKey: to.Ptr(""), - }, - }, 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsPutDelegation.json -func ExampleDelegationSettingsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDelegationSettingsClient().CreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.PortalDelegationSettings{ - Properties: &armapimanagement.PortalDelegationSettingsProperties{ - Subscriptions: &armapimanagement.SubscriptionsDelegationSettingsProperties{ - Enabled: to.Ptr(true), - }, - URL: to.Ptr("http://contoso.com/delegation"), - UserRegistration: &armapimanagement.RegistrationDelegationSettingsProperties{ - Enabled: to.Ptr(true), - }, - ValidationKey: to.Ptr(""), - }, - }, &armapimanagement.DelegationSettingsClientCreateOrUpdateOptions{IfMatch: to.Ptr("*")}) - 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.PortalDelegationSettings = armapimanagement.PortalDelegationSettings{ - // Name: to.Ptr("delegation"), - // Type: to.Ptr("Microsoft.ApiManagement/service/portalsettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/portalsettings/delegation"), - // Properties: &armapimanagement.PortalDelegationSettingsProperties{ - // Subscriptions: &armapimanagement.SubscriptionsDelegationSettingsProperties{ - // Enabled: to.Ptr(true), - // }, - // URL: to.Ptr("http://contoso.com/delegation"), - // UserRegistration: &armapimanagement.RegistrationDelegationSettingsProperties{ - // Enabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSecretsPortalSettingsValidationKey.json -func ExampleDelegationSettingsClient_ListSecrets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDelegationSettingsClient().ListSecrets(ctx, "rg1", "apimService1", 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.PortalSettingValidationKeyContract = armapimanagement.PortalSettingValidationKeyContract{ - // ValidationKey: to.Ptr(""), - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/deletedservices_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/deletedservices_client.go index 1256ee9e4113..ad0ceec93449 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/deletedservices_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/deletedservices_client.go @@ -29,8 +29,7 @@ type DeletedServicesClient struct { } // NewDeletedServicesClient creates a new instance of DeletedServicesClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDeletedServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeletedServicesClient, error) { @@ -48,7 +47,7 @@ func NewDeletedServicesClient(subscriptionID string, credential azcore.TokenCred // GetByName - Get soft-deleted Api Management Service by name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview // - serviceName - The name of the API Management service. // - location - The location of the deleted API Management service. // - options - DeletedServicesClientGetByNameOptions contains the optional parameters for the DeletedServicesClient.GetByName @@ -88,7 +87,7 @@ func (client *DeletedServicesClient) getByNameCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -105,7 +104,7 @@ func (client *DeletedServicesClient) getByNameHandleResponse(resp *http.Response // NewListBySubscriptionPager - Lists all soft-deleted services available for undelete for the given subscription. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview // - options - DeletedServicesClientListBySubscriptionOptions contains the optional parameters for the DeletedServicesClient.NewListBySubscriptionPager // method. func (client *DeletedServicesClient) NewListBySubscriptionPager(options *DeletedServicesClientListBySubscriptionOptions) *runtime.Pager[DeletedServicesClientListBySubscriptionResponse] { @@ -148,7 +147,7 @@ func (client *DeletedServicesClient) listBySubscriptionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -166,7 +165,7 @@ func (client *DeletedServicesClient) listBySubscriptionHandleResponse(resp *http // BeginPurge - Purges Api Management Service (deletes it with no option to undelete). // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview // - serviceName - The name of the API Management service. // - location - The location of the deleted API Management service. // - options - DeletedServicesClientBeginPurgeOptions contains the optional parameters for the DeletedServicesClient.BeginPurge @@ -188,7 +187,7 @@ func (client *DeletedServicesClient) BeginPurge(ctx context.Context, serviceName // Purge - Purges Api Management Service (deletes it with no option to undelete). // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *DeletedServicesClient) purge(ctx context.Context, serviceName string, location string, options *DeletedServicesClientBeginPurgeOptions) (*http.Response, error) { req, err := client.purgeCreateRequest(ctx, serviceName, location, options) if err != nil { @@ -224,7 +223,7 @@ func (client *DeletedServicesClient) purgeCreateRequest(ctx context.Context, ser return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/deletedservices_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/deletedservices_client_example_test.go deleted file mode 100644 index fad2f8b72f6e..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/deletedservices_client_example_test.go +++ /dev/null @@ -1,120 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeletedServicesListBySubscription.json -func ExampleDeletedServicesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDeletedServicesClient().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.DeletedServicesCollection = armapimanagement.DeletedServicesCollection{ - // Value: []*armapimanagement.DeletedServiceContract{ - // { - // Name: to.Ptr("apimService3"), - // Type: to.Ptr("Microsoft.ApiManagement/deletedservices"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.ApiManagement/locations/westus/deletedservices/apimService3"), - // Location: to.Ptr("West US"), - // Properties: &armapimanagement.DeletedServiceContractProperties{ - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-27T15:33:55.5426123Z"); return t}()), - // ScheduledPurgeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-27T15:33:55.5426123Z"); return t}()), - // ServiceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService3"), - // }, - // }, - // { - // Name: to.Ptr("apimService"), - // Type: to.Ptr("Microsoft.ApiManagement/deletedservices"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.ApiManagement/locations/westus2/deletedservices/apimService"), - // Location: to.Ptr("West US 2"), - // Properties: &armapimanagement.DeletedServiceContractProperties{ - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-27T15:33:55.5426123Z"); return t}()), - // ScheduledPurgeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-27T15:33:55.5426123Z"); return t}()), - // ServiceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetDeletedServiceByName.json -func ExampleDeletedServicesClient_GetByName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeletedServicesClient().GetByName(ctx, "apimService3", "westus", 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.DeletedServiceContract = armapimanagement.DeletedServiceContract{ - // Name: to.Ptr("apimService3"), - // Type: to.Ptr("Microsoft.ApiManagement/deletedservices"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.ApiManagement/locations/westus/deletedservices/apimService3"), - // Location: to.Ptr("West US"), - // Properties: &armapimanagement.DeletedServiceContractProperties{ - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-27T15:33:55.5426123Z"); return t}()), - // ScheduledPurgeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-27T15:33:55.5426123Z"); return t}()), - // ServiceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService3"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeletedServicesPurge.json -func ExampleDeletedServicesClient_BeginPurge() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeletedServicesClient().BeginPurge(ctx, "apimService3", "westus", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/diagnostic_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/diagnostic_client.go index a55cdec6059a..631a5dbc046e 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/diagnostic_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/diagnostic_client.go @@ -30,8 +30,7 @@ type DiagnosticClient struct { } // NewDiagnosticClient creates a new instance of DiagnosticClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDiagnosticClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DiagnosticClient, error) { @@ -49,8 +48,8 @@ func NewDiagnosticClient(subscriptionID string, credential azcore.TokenCredentia // CreateOrUpdate - Creates a new Diagnostic or updates an existing one. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - diagnosticID - Diagnostic identifier. Must be unique in the current API Management service instance. // - parameters - Create parameters. @@ -95,7 +94,7 @@ func (client *DiagnosticClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -119,8 +118,8 @@ func (client *DiagnosticClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Deletes the specified Diagnostic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - diagnosticID - Diagnostic identifier. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -165,7 +164,7 @@ func (client *DiagnosticClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -175,8 +174,8 @@ func (client *DiagnosticClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets the details of the Diagnostic specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - diagnosticID - Diagnostic identifier. Must be unique in the current API Management service instance. // - options - DiagnosticClientGetOptions contains the optional parameters for the DiagnosticClient.Get method. @@ -219,7 +218,7 @@ func (client *DiagnosticClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -239,8 +238,8 @@ func (client *DiagnosticClient) getHandleResponse(resp *http.Response) (Diagnost // GetEntityTag - Gets the entity state (Etag) version of the Diagnostic specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - diagnosticID - Diagnostic identifier. Must be unique in the current API Management service instance. // - options - DiagnosticClientGetEntityTagOptions contains the optional parameters for the DiagnosticClient.GetEntityTag method. @@ -283,7 +282,7 @@ func (client *DiagnosticClient) getEntityTagCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -301,8 +300,8 @@ func (client *DiagnosticClient) getEntityTagHandleResponse(resp *http.Response) // NewListByServicePager - Lists all diagnostics of the API Management service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - DiagnosticClientListByServiceOptions contains the optional parameters for the DiagnosticClient.NewListByServicePager // method. @@ -363,7 +362,7 @@ func (client *DiagnosticClient) listByServiceCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -381,8 +380,8 @@ func (client *DiagnosticClient) listByServiceHandleResponse(resp *http.Response) // Update - Updates the details of the Diagnostic specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - diagnosticID - Diagnostic identifier. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -428,7 +427,7 @@ func (client *DiagnosticClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/diagnostic_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/diagnostic_client_example_test.go deleted file mode 100644 index f0842e8682d0..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/diagnostic_client_example_test.go +++ /dev/null @@ -1,427 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListDiagnostics.json -func ExampleDiagnosticClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiagnosticClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.DiagnosticClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.DiagnosticCollection = armapimanagement.DiagnosticCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.DiagnosticContract{ - // { - // Name: to.Ptr("applicationinsights"), - // Type: to.Ptr("Microsoft.ApiManagement/service/diagnostics"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights"), - // Properties: &armapimanagement.DiagnosticContractProperties{ - // AlwaysLog: to.Ptr(armapimanagement.AlwaysLogAllErrors), - // Backend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](0), - // }, - // Headers: []*string{ - // }, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](0), - // }, - // Headers: []*string{ - // }, - // }, - // }, - // Frontend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](0), - // }, - // Headers: []*string{ - // }, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](0), - // }, - // Headers: []*string{ - // }, - // }, - // }, - // HTTPCorrelationProtocol: to.Ptr(armapimanagement.HTTPCorrelationProtocolLegacy), - // LogClientIP: to.Ptr(true), - // LoggerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/aisamplingtest"), - // Sampling: &armapimanagement.SamplingSettings{ - // Percentage: to.Ptr[float64](100), - // SamplingType: to.Ptr(armapimanagement.SamplingTypeFixed), - // }, - // Verbosity: to.Ptr(armapimanagement.VerbosityInformation), - // }, - // }, - // { - // Name: to.Ptr("azuremonitor"), - // Type: to.Ptr("Microsoft.ApiManagement/service/diagnostics"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/azuremonitor"), - // Properties: &armapimanagement.DiagnosticContractProperties{ - // LogClientIP: to.Ptr(true), - // LoggerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/azuremonitor"), - // Sampling: &armapimanagement.SamplingSettings{ - // Percentage: to.Ptr[float64](100), - // SamplingType: to.Ptr(armapimanagement.SamplingTypeFixed), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadDiagnostic.json -func ExampleDiagnosticClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDiagnosticClient().GetEntityTag(ctx, "rg1", "apimService1", "applicationinsights", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetDiagnostic.json -func ExampleDiagnosticClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticClient().Get(ctx, "rg1", "apimService1", "applicationinsights", 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.DiagnosticContract = armapimanagement.DiagnosticContract{ - // Name: to.Ptr("applicationinsights"), - // Type: to.Ptr("Microsoft.ApiManagement/service/diagnostics"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights"), - // Properties: &armapimanagement.DiagnosticContractProperties{ - // AlwaysLog: to.Ptr(armapimanagement.AlwaysLogAllErrors), - // Backend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // }, - // Frontend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](100), - // }, - // Headers: []*string{ - // }, - // }, - // }, - // HTTPCorrelationProtocol: to.Ptr(armapimanagement.HTTPCorrelationProtocolLegacy), - // LogClientIP: to.Ptr(true), - // LoggerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/aisamplingtest"), - // Sampling: &armapimanagement.SamplingSettings{ - // Percentage: to.Ptr[float64](100), - // SamplingType: to.Ptr(armapimanagement.SamplingTypeFixed), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateDiagnostic.json -func ExampleDiagnosticClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticClient().CreateOrUpdate(ctx, "rg1", "apimService1", "applicationinsights", armapimanagement.DiagnosticContract{ - Properties: &armapimanagement.DiagnosticContractProperties{ - AlwaysLog: to.Ptr(armapimanagement.AlwaysLogAllErrors), - Backend: &armapimanagement.PipelineDiagnosticSettings{ - Response: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - Request: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - }, - Frontend: &armapimanagement.PipelineDiagnosticSettings{ - Response: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - Request: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - }, - LoggerID: to.Ptr("/loggers/azuremonitor"), - Sampling: &armapimanagement.SamplingSettings{ - Percentage: to.Ptr[float64](50), - SamplingType: to.Ptr(armapimanagement.SamplingTypeFixed), - }, - }, - }, &armapimanagement.DiagnosticClientCreateOrUpdateOptions{IfMatch: 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.DiagnosticContract = armapimanagement.DiagnosticContract{ - // Name: to.Ptr("applicationinsights"), - // Type: to.Ptr("Microsoft.ApiManagement/service/diagnostics"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights"), - // Properties: &armapimanagement.DiagnosticContractProperties{ - // AlwaysLog: to.Ptr(armapimanagement.AlwaysLogAllErrors), - // Backend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](512), - // }, - // Headers: []*string{ - // to.Ptr("Content-type")}, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](512), - // }, - // Headers: []*string{ - // to.Ptr("Content-type")}, - // }, - // }, - // Frontend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](512), - // }, - // Headers: []*string{ - // to.Ptr("Content-type")}, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](512), - // }, - // Headers: []*string{ - // to.Ptr("Content-type")}, - // }, - // }, - // LoggerID: to.Ptr("/loggers/applicationinsights"), - // Sampling: &armapimanagement.SamplingSettings{ - // Percentage: to.Ptr[float64](50), - // SamplingType: to.Ptr(armapimanagement.SamplingTypeFixed), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateDiagnostic.json -func ExampleDiagnosticClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticClient().Update(ctx, "rg1", "apimService1", "applicationinsights", "*", armapimanagement.DiagnosticContract{ - Properties: &armapimanagement.DiagnosticContractProperties{ - AlwaysLog: to.Ptr(armapimanagement.AlwaysLogAllErrors), - Backend: &armapimanagement.PipelineDiagnosticSettings{ - Response: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - Request: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - }, - Frontend: &armapimanagement.PipelineDiagnosticSettings{ - Response: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - Request: &armapimanagement.HTTPMessageDiagnostic{ - Body: &armapimanagement.BodyDiagnosticSettings{ - Bytes: to.Ptr[int32](512), - }, - Headers: []*string{ - to.Ptr("Content-type")}, - }, - }, - LoggerID: to.Ptr("/loggers/applicationinsights"), - Sampling: &armapimanagement.SamplingSettings{ - Percentage: to.Ptr[float64](50), - SamplingType: to.Ptr(armapimanagement.SamplingTypeFixed), - }, - }, - }, 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.DiagnosticContract = armapimanagement.DiagnosticContract{ - // Name: to.Ptr("applicationinsights"), - // Type: to.Ptr("Microsoft.ApiManagement/service/diagnostics"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights"), - // Properties: &armapimanagement.DiagnosticContractProperties{ - // AlwaysLog: to.Ptr(armapimanagement.AlwaysLogAllErrors), - // Backend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](512), - // }, - // Headers: []*string{ - // to.Ptr("Content-type")}, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](512), - // }, - // Headers: []*string{ - // to.Ptr("Content-type")}, - // }, - // }, - // Frontend: &armapimanagement.PipelineDiagnosticSettings{ - // Response: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](512), - // }, - // Headers: []*string{ - // to.Ptr("Content-type")}, - // }, - // Request: &armapimanagement.HTTPMessageDiagnostic{ - // Body: &armapimanagement.BodyDiagnosticSettings{ - // Bytes: to.Ptr[int32](512), - // }, - // Headers: []*string{ - // to.Ptr("Content-type")}, - // }, - // }, - // HTTPCorrelationProtocol: to.Ptr(armapimanagement.HTTPCorrelationProtocolLegacy), - // LogClientIP: to.Ptr(true), - // LoggerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/aisamplingtest"), - // Sampling: &armapimanagement.SamplingSettings{ - // Percentage: to.Ptr[float64](50), - // SamplingType: to.Ptr(armapimanagement.SamplingTypeFixed), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteDiagnostic.json -func ExampleDiagnosticClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDiagnosticClient().Delete(ctx, "rg1", "apimService1", "applicationinsights", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/documentation_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/documentation_client.go new file mode 100644 index 000000000000..408f6a511062 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/documentation_client.go @@ -0,0 +1,448 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// DocumentationClient contains the methods for the Documentation group. +// Don't use this type directly, use NewDocumentationClient() instead. +type DocumentationClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDocumentationClient creates a new instance of DocumentationClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDocumentationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DocumentationClient, error) { + cl, err := arm.NewClient(moduleName+".DocumentationClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DocumentationClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates a new Documentation or updates an existing one. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - documentationID - Documentation identifier. Must be unique in the current API Management service instance. +// - parameters - Create parameters. +// - options - DocumentationClientCreateOrUpdateOptions contains the optional parameters for the DocumentationClient.CreateOrUpdate +// method. +func (client *DocumentationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, documentationID string, parameters DocumentationContract, options *DocumentationClientCreateOrUpdateOptions) (DocumentationClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, documentationID, parameters, options) + if err != nil { + return DocumentationClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DocumentationClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return DocumentationClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DocumentationClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, documentationID string, parameters DocumentationContract, options *DocumentationClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if documentationID == "" { + return nil, errors.New("parameter documentationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{documentationId}", url.PathEscape(documentationID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *DocumentationClient) createOrUpdateHandleResponse(resp *http.Response) (DocumentationClientCreateOrUpdateResponse, error) { + result := DocumentationClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.DocumentationContract); err != nil { + return DocumentationClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified Documentation from an API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - documentationID - Documentation identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - DocumentationClientDeleteOptions contains the optional parameters for the DocumentationClient.Delete method. +func (client *DocumentationClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, documentationID string, ifMatch string, options *DocumentationClientDeleteOptions) (DocumentationClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, documentationID, ifMatch, options) + if err != nil { + return DocumentationClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DocumentationClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return DocumentationClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return DocumentationClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DocumentationClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, documentationID string, ifMatch string, options *DocumentationClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if documentationID == "" { + return nil, errors.New("parameter documentationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{documentationId}", url.PathEscape(documentationID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the Documentation specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - documentationID - Documentation identifier. Must be unique in the current API Management service instance. +// - options - DocumentationClientGetOptions contains the optional parameters for the DocumentationClient.Get method. +func (client *DocumentationClient) Get(ctx context.Context, resourceGroupName string, serviceName string, documentationID string, options *DocumentationClientGetOptions) (DocumentationClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, documentationID, options) + if err != nil { + return DocumentationClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DocumentationClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DocumentationClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DocumentationClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, documentationID string, options *DocumentationClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if documentationID == "" { + return nil, errors.New("parameter documentationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{documentationId}", url.PathEscape(documentationID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DocumentationClient) getHandleResponse(resp *http.Response) (DocumentationClientGetResponse, error) { + result := DocumentationClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.DocumentationContract); err != nil { + return DocumentationClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the Documentation by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - documentationID - Documentation identifier. Must be unique in the current API Management service instance. +// - options - DocumentationClientGetEntityTagOptions contains the optional parameters for the DocumentationClient.GetEntityTag +// method. +func (client *DocumentationClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, documentationID string, options *DocumentationClientGetEntityTagOptions) (DocumentationClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, documentationID, options) + if err != nil { + return DocumentationClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DocumentationClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DocumentationClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *DocumentationClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, documentationID string, options *DocumentationClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if documentationID == "" { + return nil, errors.New("parameter documentationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{documentationId}", url.PathEscape(documentationID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *DocumentationClient) getEntityTagHandleResponse(resp *http.Response) (DocumentationClientGetEntityTagResponse, error) { + result := DocumentationClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByServicePager - Lists all Documentations of the API Management service instance. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - options - DocumentationClientListByServiceOptions contains the optional parameters for the DocumentationClient.NewListByServicePager +// method. +func (client *DocumentationClient) NewListByServicePager(resourceGroupName string, serviceName string, options *DocumentationClientListByServiceOptions) *runtime.Pager[DocumentationClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[DocumentationClientListByServiceResponse]{ + More: func(page DocumentationClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DocumentationClientListByServiceResponse) (DocumentationClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DocumentationClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DocumentationClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DocumentationClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *DocumentationClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *DocumentationClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *DocumentationClient) listByServiceHandleResponse(resp *http.Response) (DocumentationClientListByServiceResponse, error) { + result := DocumentationClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DocumentationCollection); err != nil { + return DocumentationClientListByServiceResponse{}, err + } + return result, nil +} + +// Update - Updates the details of the Documentation for an API specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - documentationID - Documentation identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - Documentation Update parameters. +// - options - DocumentationClientUpdateOptions contains the optional parameters for the DocumentationClient.Update method. +func (client *DocumentationClient) Update(ctx context.Context, resourceGroupName string, serviceName string, documentationID string, ifMatch string, parameters DocumentationUpdateContract, options *DocumentationClientUpdateOptions) (DocumentationClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, documentationID, ifMatch, parameters, options) + if err != nil { + return DocumentationClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DocumentationClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DocumentationClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *DocumentationClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, documentationID string, ifMatch string, parameters DocumentationUpdateContract, options *DocumentationClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if documentationID == "" { + return nil, errors.New("parameter documentationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{documentationId}", url.PathEscape(documentationID)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *DocumentationClient) updateHandleResponse(resp *http.Response) (DocumentationClientUpdateResponse, error) { + result := DocumentationClientUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.DocumentationContract); err != nil { + return DocumentationClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/emailtemplate_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/emailtemplate_client.go index 4d5e321d6375..131940be9586 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/emailtemplate_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/emailtemplate_client.go @@ -30,8 +30,7 @@ type EmailTemplateClient struct { } // NewEmailTemplateClient creates a new instance of EmailTemplateClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewEmailTemplateClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EmailTemplateClient, error) { @@ -49,8 +48,8 @@ func NewEmailTemplateClient(subscriptionID string, credential azcore.TokenCreden // CreateOrUpdate - Updates an Email Template. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - templateName - Email Template Name Identifier. // - parameters - Email Template update parameters. @@ -95,7 +94,7 @@ func (client *EmailTemplateClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -116,8 +115,8 @@ func (client *EmailTemplateClient) createOrUpdateHandleResponse(resp *http.Respo // Delete - Reset the Email Template to default template provided by the API Management service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - templateName - Email Template Name Identifier. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -162,7 +161,7 @@ func (client *EmailTemplateClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -172,8 +171,8 @@ func (client *EmailTemplateClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets the details of the email template specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - templateName - Email Template Name Identifier. // - options - EmailTemplateClientGetOptions contains the optional parameters for the EmailTemplateClient.Get method. @@ -216,7 +215,7 @@ func (client *EmailTemplateClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -236,8 +235,8 @@ func (client *EmailTemplateClient) getHandleResponse(resp *http.Response) (Email // GetEntityTag - Gets the entity state (Etag) version of the email template specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - templateName - Email Template Name Identifier. // - options - EmailTemplateClientGetEntityTagOptions contains the optional parameters for the EmailTemplateClient.GetEntityTag @@ -281,7 +280,7 @@ func (client *EmailTemplateClient) getEntityTagCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -299,8 +298,8 @@ func (client *EmailTemplateClient) getEntityTagHandleResponse(resp *http.Respons // NewListByServicePager - Gets all email templates // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - EmailTemplateClientListByServiceOptions contains the optional parameters for the EmailTemplateClient.NewListByServicePager // method. @@ -361,7 +360,7 @@ func (client *EmailTemplateClient) listByServiceCreateRequest(ctx context.Contex if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -379,8 +378,8 @@ func (client *EmailTemplateClient) listByServiceHandleResponse(resp *http.Respon // Update - Updates API Management email template // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - templateName - Email Template Name Identifier. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -426,7 +425,7 @@ func (client *EmailTemplateClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/emailtemplate_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/emailtemplate_client_example_test.go deleted file mode 100644 index 859c0e5a83c1..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/emailtemplate_client_example_test.go +++ /dev/null @@ -1,302 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTemplates.json -func ExampleEmailTemplateClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEmailTemplateClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.EmailTemplateClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.EmailTemplateCollection = armapimanagement.EmailTemplateCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.EmailTemplateContract{ - // { - // Name: to.Ptr("ApplicationApprovedNotificationMessage"), - // Type: to.Ptr("Microsoft.ApiManagement/service/templates"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/templates/ApplicationApprovedNotificationMessage"), - // Properties: &armapimanagement.EmailTemplateContractProperties{ - // Description: to.Ptr("Developers who submitted their application for publication in the application gallery on the developer portal receive this email after their submission is approved."), - // Body: to.Ptr("\r\n\r\n \r\n \r\n

Dear $DevFirstName $DevLastName,

\r\n

\r\n We are happy to let you know that your request to publish the $AppName application in the application gallery has been approved. Your application has been published and can be viewed here.\r\n

\r\n

Best,

\r\n

The $OrganizationName API Team

\r\n \r\n"), - // IsDefault: to.Ptr(true), - // Parameters: []*armapimanagement.EmailTemplateParametersContractProperties{ - // { - // Name: to.Ptr("AppId"), - // Title: to.Ptr("Application id"), - // }, - // { - // Name: to.Ptr("AppName"), - // Title: to.Ptr("Application name"), - // }, - // { - // Name: to.Ptr("DevFirstName"), - // Title: to.Ptr("Developer first name"), - // }, - // { - // Name: to.Ptr("DevLastName"), - // Title: to.Ptr("Developer last name"), - // }, - // { - // Name: to.Ptr("OrganizationName"), - // Title: to.Ptr("Organization name"), - // }, - // { - // Name: to.Ptr("DevPortalUrl"), - // Title: to.Ptr("Developer portal URL"), - // }}, - // Subject: to.Ptr("Your application $AppName is published in the application gallery"), - // Title: to.Ptr("Application gallery submission approved"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadEmailTemplate.json -func ExampleEmailTemplateClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewEmailTemplateClient().GetEntityTag(ctx, "rg1", "apimService1", armapimanagement.TemplateNameNewIssueNotificationMessage, 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTemplate.json -func ExampleEmailTemplateClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEmailTemplateClient().Get(ctx, "rg1", "apimService1", armapimanagement.TemplateNameNewIssueNotificationMessage, 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.EmailTemplateContract = armapimanagement.EmailTemplateContract{ - // Name: to.Ptr("NewIssueNotificationMessage"), - // Type: to.Ptr("Microsoft.ApiManagement/service/templates"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/templates/NewIssueNotificationMessage"), - // Properties: &armapimanagement.EmailTemplateContractProperties{ - // Description: to.Ptr("This email is sent to developers after they create a new topic on the Issues page of the developer portal."), - // Body: to.Ptr("\r\n\r\n \r\n \r\n

Dear $DevFirstName $DevLastName,

\r\n

Thank you for contacting us. Our API team will review your issue and get back to you soon.

\r\n

\r\n Click this link to view or edit your request.\r\n

\r\n

Best,

\r\n

The $OrganizationName API Team

\r\n \r\n"), - // IsDefault: to.Ptr(true), - // Parameters: []*armapimanagement.EmailTemplateParametersContractProperties{ - // { - // Name: to.Ptr("DevFirstName"), - // Title: to.Ptr("Developer first name"), - // }, - // { - // Name: to.Ptr("DevLastName"), - // Title: to.Ptr("Developer last name"), - // }, - // { - // Name: to.Ptr("IssueId"), - // Title: to.Ptr("Issue id"), - // }, - // { - // Name: to.Ptr("IssueName"), - // Title: to.Ptr("Issue name"), - // }, - // { - // Name: to.Ptr("OrganizationName"), - // Title: to.Ptr("Organization name"), - // }, - // { - // Name: to.Ptr("DevPortalUrl"), - // Title: to.Ptr("Developer portal URL"), - // }}, - // Subject: to.Ptr("Your request $IssueName was received"), - // Title: to.Ptr("New issue received"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateTemplate.json -func ExampleEmailTemplateClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEmailTemplateClient().CreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.TemplateNameNewIssueNotificationMessage, armapimanagement.EmailTemplateUpdateParameters{ - Properties: &armapimanagement.EmailTemplateUpdateParameterProperties{ - Subject: to.Ptr("Your request for $IssueName was successfully received."), - }, - }, &armapimanagement.EmailTemplateClientCreateOrUpdateOptions{IfMatch: 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.EmailTemplateContract = armapimanagement.EmailTemplateContract{ - // Name: to.Ptr("NewIssueNotificationMessage"), - // Type: to.Ptr("Microsoft.ApiManagement/service/templates"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/templates/NewIssueNotificationMessage"), - // Properties: &armapimanagement.EmailTemplateContractProperties{ - // Description: to.Ptr("This email is sent to developers after they create a new topic on the Issues page of the developer portal."), - // Body: to.Ptr("\r\n\r\n \r\n \r\n

Dear $DevFirstName $DevLastName,

\r\n

Thank you for contacting us. Our API team will review your issue and get back to you soon.

\r\n

\r\n Click this link to view or edit your request.\r\n

\r\n

Best,

\r\n

The $OrganizationName API Team

\r\n \r\n"), - // IsDefault: to.Ptr(false), - // Parameters: []*armapimanagement.EmailTemplateParametersContractProperties{ - // { - // Name: to.Ptr("DevFirstName"), - // Title: to.Ptr("Developer first name"), - // }, - // { - // Name: to.Ptr("DevLastName"), - // Title: to.Ptr("Developer last name"), - // }, - // { - // Name: to.Ptr("IssueId"), - // Title: to.Ptr("Issue id"), - // }, - // { - // Name: to.Ptr("IssueName"), - // Title: to.Ptr("Issue name"), - // }, - // { - // Name: to.Ptr("OrganizationName"), - // Title: to.Ptr("Organization name"), - // }, - // { - // Name: to.Ptr("DevPortalUrl"), - // Title: to.Ptr("Developer portal URL"), - // }}, - // Subject: to.Ptr("Your request for $IssueName was successfully received."), - // Title: to.Ptr("New issue received"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateTemplate.json -func ExampleEmailTemplateClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEmailTemplateClient().Update(ctx, "rg1", "apimService1", armapimanagement.TemplateNameNewIssueNotificationMessage, "*", armapimanagement.EmailTemplateUpdateParameters{ - Properties: &armapimanagement.EmailTemplateUpdateParameterProperties{ - Body: to.Ptr("\r\n\r\n \r\n \r\n

Dear $DevFirstName $DevLastName,

\r\n

\r\n We are happy to let you know that your request to publish the $AppName application in the gallery has been approved. Your application has been published and can be viewed here.\r\n

\r\n

Best,

\r\n

The $OrganizationName API Team

\r\n \r\n"), - Subject: to.Ptr("Your request $IssueName was received"), - }, - }, 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.EmailTemplateContract = armapimanagement.EmailTemplateContract{ - // Name: to.Ptr("NewIssueNotificationMessage"), - // Type: to.Ptr("Microsoft.ApiManagement/service/templates"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/templates/NewIssueNotificationMessage"), - // Properties: &armapimanagement.EmailTemplateContractProperties{ - // Description: to.Ptr("This email is sent to developers after they create a new topic on the Issues page of the developer portal."), - // Body: to.Ptr("\r\n\r\n \r\n \r\n

Dear $DevFirstName $DevLastName,

\r\n

Thank you for contacting us. Our API team will review your issue and get back to you soon.

\r\n

\r\n Click this link to view or edit your request.\r\n

\r\n

Best,

\r\n

The $OrganizationName API Team

\r\n \r\n"), - // IsDefault: to.Ptr(true), - // Parameters: []*armapimanagement.EmailTemplateParametersContractProperties{ - // { - // Name: to.Ptr("DevFirstName"), - // Title: to.Ptr("Developer first name"), - // }, - // { - // Name: to.Ptr("DevLastName"), - // Title: to.Ptr("Developer last name"), - // }, - // { - // Name: to.Ptr("IssueId"), - // Title: to.Ptr("Issue id"), - // }, - // { - // Name: to.Ptr("IssueName"), - // Title: to.Ptr("Issue name"), - // }, - // { - // Name: to.Ptr("OrganizationName"), - // Title: to.Ptr("Organization name"), - // }, - // { - // Name: to.Ptr("DevPortalUrl"), - // Title: to.Ptr("Developer portal URL"), - // }}, - // Subject: to.Ptr("Your request $IssueName was received"), - // Title: to.Ptr("New issue received"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteTemplate.json -func ExampleEmailTemplateClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewEmailTemplateClient().Delete(ctx, "rg1", "apimService1", armapimanagement.TemplateNameNewIssueNotificationMessage, "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/gateway_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/gateway_client.go index 090a071f5aa9..91251c68ea5d 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/gateway_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/gateway_client.go @@ -30,8 +30,7 @@ type GatewayClient struct { } // NewGatewayClient creates a new instance of GatewayClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewGatewayClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GatewayClient, error) { @@ -49,8 +48,8 @@ func NewGatewayClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Creates or updates a Gateway to be used in Api Management instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -94,7 +93,7 @@ func (client *GatewayClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -118,8 +117,8 @@ func (client *GatewayClient) createOrUpdateHandleResponse(resp *http.Response) ( // Delete - Deletes specific Gateway. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -165,7 +164,7 @@ func (client *GatewayClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -175,8 +174,8 @@ func (client *GatewayClient) deleteCreateRequest(ctx context.Context, resourceGr // GenerateToken - Gets the Shared Access Authorization Token for the gateway. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -220,7 +219,7 @@ func (client *GatewayClient) generateTokenCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -238,8 +237,8 @@ func (client *GatewayClient) generateTokenHandleResponse(resp *http.Response) (G // Get - Gets the details of the Gateway specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -283,7 +282,7 @@ func (client *GatewayClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -303,8 +302,8 @@ func (client *GatewayClient) getHandleResponse(resp *http.Response) (GatewayClie // GetEntityTag - Gets the entity state (Etag) version of the Gateway specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -348,7 +347,7 @@ func (client *GatewayClient) getEntityTagCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -364,10 +363,65 @@ func (client *GatewayClient) getEntityTagHandleResponse(resp *http.Response) (Ga return result, nil } +// InvalidateDebugCredentials - Action is invalidating all debug credentials issued for gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value +// 'managed' +// - options - GatewayClientInvalidateDebugCredentialsOptions contains the optional parameters for the GatewayClient.InvalidateDebugCredentials +// method. +func (client *GatewayClient) InvalidateDebugCredentials(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, options *GatewayClientInvalidateDebugCredentialsOptions) (GatewayClientInvalidateDebugCredentialsResponse, error) { + req, err := client.invalidateDebugCredentialsCreateRequest(ctx, resourceGroupName, serviceName, gatewayID, options) + if err != nil { + return GatewayClientInvalidateDebugCredentialsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GatewayClientInvalidateDebugCredentialsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return GatewayClientInvalidateDebugCredentialsResponse{}, runtime.NewResponseError(resp) + } + return GatewayClientInvalidateDebugCredentialsResponse{}, nil +} + +// invalidateDebugCredentialsCreateRequest creates the InvalidateDebugCredentials request. +func (client *GatewayClient) invalidateDebugCredentialsCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, options *GatewayClientInvalidateDebugCredentialsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/invalidateDebugCredentials" + 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 serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if gatewayID == "" { + return nil, errors.New("parameter gatewayID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayId}", url.PathEscape(gatewayID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // NewListByServicePager - Lists a collection of gateways registered with service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - GatewayClientListByServiceOptions contains the optional parameters for the GatewayClient.NewListByServicePager // method. @@ -428,7 +482,7 @@ func (client *GatewayClient) listByServiceCreateRequest(ctx context.Context, res if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -443,11 +497,75 @@ func (client *GatewayClient) listByServiceHandleResponse(resp *http.Response) (G return result, nil } +// ListDebugCredentials - Create new debug credentials for gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value +// 'managed' +// - options - GatewayClientListDebugCredentialsOptions contains the optional parameters for the GatewayClient.ListDebugCredentials +// method. +func (client *GatewayClient) ListDebugCredentials(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayListDebugCredentialsContract, options *GatewayClientListDebugCredentialsOptions) (GatewayClientListDebugCredentialsResponse, error) { + req, err := client.listDebugCredentialsCreateRequest(ctx, resourceGroupName, serviceName, gatewayID, parameters, options) + if err != nil { + return GatewayClientListDebugCredentialsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GatewayClientListDebugCredentialsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GatewayClientListDebugCredentialsResponse{}, runtime.NewResponseError(resp) + } + return client.listDebugCredentialsHandleResponse(resp) +} + +// listDebugCredentialsCreateRequest creates the ListDebugCredentials request. +func (client *GatewayClient) listDebugCredentialsCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayListDebugCredentialsContract, options *GatewayClientListDebugCredentialsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listDebugCredentials" + 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 serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if gatewayID == "" { + return nil, errors.New("parameter gatewayID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayId}", url.PathEscape(gatewayID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// listDebugCredentialsHandleResponse handles the ListDebugCredentials response. +func (client *GatewayClient) listDebugCredentialsHandleResponse(resp *http.Response) (GatewayClientListDebugCredentialsResponse, error) { + result := GatewayClientListDebugCredentialsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GatewayDebugCredentialsContract); err != nil { + return GatewayClientListDebugCredentialsResponse{}, err + } + return result, nil +} + // ListKeys - Retrieves gateway keys. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -491,7 +609,7 @@ func (client *GatewayClient) listKeysCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -509,11 +627,74 @@ func (client *GatewayClient) listKeysHandleResponse(resp *http.Response) (Gatewa return result, nil } +// ListTrace - Fetches trace collected by gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value +// 'managed' +// - options - GatewayClientListTraceOptions contains the optional parameters for the GatewayClient.ListTrace method. +func (client *GatewayClient) ListTrace(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayListTraceContract, options *GatewayClientListTraceOptions) (GatewayClientListTraceResponse, error) { + req, err := client.listTraceCreateRequest(ctx, resourceGroupName, serviceName, gatewayID, parameters, options) + if err != nil { + return GatewayClientListTraceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GatewayClientListTraceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GatewayClientListTraceResponse{}, runtime.NewResponseError(resp) + } + return client.listTraceHandleResponse(resp) +} + +// listTraceCreateRequest creates the ListTrace request. +func (client *GatewayClient) listTraceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayListTraceContract, options *GatewayClientListTraceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listTrace" + 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 serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if gatewayID == "" { + return nil, errors.New("parameter gatewayID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayId}", url.PathEscape(gatewayID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// listTraceHandleResponse handles the ListTrace response. +func (client *GatewayClient) listTraceHandleResponse(resp *http.Response) (GatewayClientListTraceResponse, error) { + result := GatewayClientListTraceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { + return GatewayClientListTraceResponse{}, err + } + return result, nil +} + // RegenerateKey - Regenerates specified gateway key invalidating any tokens created with it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -557,7 +738,7 @@ func (client *GatewayClient) regenerateKeyCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -566,8 +747,8 @@ func (client *GatewayClient) regenerateKeyCreateRequest(ctx context.Context, res // Update - Updates the details of the gateway specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -613,7 +794,7 @@ func (client *GatewayClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/gateway_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/gateway_client_example_test.go deleted file mode 100644 index c11f695e2c8a..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/gateway_client_example_test.go +++ /dev/null @@ -1,285 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "time" - - "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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGateways.json -func ExampleGatewayClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGatewayClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.GatewayClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.GatewayCollection = armapimanagement.GatewayCollection{ - // Count: to.Ptr[int64](2), - // Value: []*armapimanagement.GatewayContract{ - // { - // Name: to.Ptr("a1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1"), - // Properties: &armapimanagement.GatewayContractProperties{ - // Description: to.Ptr("my gateway 1"), - // LocationData: &armapimanagement.ResourceLocationDataContract{ - // Name: to.Ptr("my location 1"), - // }, - // }, - // }, - // { - // Name: to.Ptr("5a73933b8f27f7cc82a2d533"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw2"), - // Properties: &armapimanagement.GatewayContractProperties{ - // Description: to.Ptr("my gateway 2"), - // LocationData: &armapimanagement.ResourceLocationDataContract{ - // Name: to.Ptr("my location 2"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGateway.json -func ExampleGatewayClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGatewayClient().GetEntityTag(ctx, "rg1", "apimService1", "mygateway", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGateway.json -func ExampleGatewayClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGatewayClient().Get(ctx, "rg1", "apimService1", "gw1", 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.GatewayContract = armapimanagement.GatewayContract{ - // Name: to.Ptr("a1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1"), - // Properties: &armapimanagement.GatewayContractProperties{ - // Description: to.Ptr("my gateway 1"), - // LocationData: &armapimanagement.ResourceLocationDataContract{ - // Name: to.Ptr("my location"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGateway.json -func ExampleGatewayClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGatewayClient().CreateOrUpdate(ctx, "rg1", "apimService1", "gw1", armapimanagement.GatewayContract{ - Properties: &armapimanagement.GatewayContractProperties{ - Description: to.Ptr("my gateway 1"), - LocationData: &armapimanagement.ResourceLocationDataContract{ - Name: to.Ptr("my location"), - }, - }, - }, &armapimanagement.GatewayClientCreateOrUpdateOptions{IfMatch: 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.GatewayContract = armapimanagement.GatewayContract{ - // Name: to.Ptr("a1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1"), - // Properties: &armapimanagement.GatewayContractProperties{ - // Description: to.Ptr("my gateway 1"), - // LocationData: &armapimanagement.ResourceLocationDataContract{ - // Name: to.Ptr("my location"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateGateway.json -func ExampleGatewayClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGatewayClient().Update(ctx, "rg1", "apimService1", "gw1", "*", armapimanagement.GatewayContract{ - Properties: &armapimanagement.GatewayContractProperties{ - Description: to.Ptr("my gateway 1"), - LocationData: &armapimanagement.ResourceLocationDataContract{ - Name: to.Ptr("my location"), - }, - }, - }, 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.GatewayContract = armapimanagement.GatewayContract{ - // Name: to.Ptr("a1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1"), - // Properties: &armapimanagement.GatewayContractProperties{ - // Description: to.Ptr("my gateway 1"), - // LocationData: &armapimanagement.ResourceLocationDataContract{ - // Name: to.Ptr("my location"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGateway.json -func ExampleGatewayClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGatewayClient().Delete(ctx, "rg1", "apimService1", "gw1", "*", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGatewayListKeys.json -func ExampleGatewayClient_ListKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGatewayClient().ListKeys(ctx, "rg1", "apimService1", "gw1", 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.GatewayKeysContract = armapimanagement.GatewayKeysContract{ - // Primary: to.Ptr("primary_key_value"), - // Secondary: to.Ptr("secondary_key_value"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGatewayRegenerateKey.json -func ExampleGatewayClient_RegenerateKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGatewayClient().RegenerateKey(ctx, "rg1", "apimService1", "gwId", armapimanagement.GatewayKeyRegenerationRequestContract{ - KeyType: to.Ptr(armapimanagement.KeyTypePrimary), - }, 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGatewayGenerateToken.json -func ExampleGatewayClient_GenerateToken() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGatewayClient().GenerateToken(ctx, "rg1", "apimService1", "gw1", armapimanagement.GatewayTokenRequestContract{ - Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-21T00:44:24.2845269Z"); return t }()), - KeyType: to.Ptr(armapimanagement.KeyTypePrimary), - }, 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.GatewayTokenContract = armapimanagement.GatewayTokenContract{ - // Value: to.Ptr("gw1&201904210044&9A1GR1f5WIhFvFmzQG+xxxxxxxxxxx/kBeu87DWad3tkasUXuvPL+MgzlwUHyg=="), - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/gatewayapi_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/gatewayapi_client.go index 07f196a6224e..18e1b496c3c0 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/gatewayapi_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/gatewayapi_client.go @@ -30,8 +30,7 @@ type GatewayAPIClient struct { } // NewGatewayAPIClient creates a new instance of GatewayAPIClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewGatewayAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GatewayAPIClient, error) { @@ -49,8 +48,8 @@ func NewGatewayAPIClient(subscriptionID string, credential azcore.TokenCredentia // CreateOrUpdate - Adds an API to the specified Gateway. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -100,7 +99,7 @@ func (client *GatewayAPIClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Parameters != nil { @@ -121,8 +120,8 @@ func (client *GatewayAPIClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Deletes the specified API from the specified Gateway. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -171,7 +170,7 @@ func (client *GatewayAPIClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -179,8 +178,8 @@ func (client *GatewayAPIClient) deleteCreateRequest(ctx context.Context, resourc // GetEntityTag - Checks that API entity specified by identifier is associated with the Gateway entity. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -229,7 +228,7 @@ func (client *GatewayAPIClient) getEntityTagCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -247,8 +246,8 @@ func (client *GatewayAPIClient) getEntityTagHandleResponse(resp *http.Response) // NewListByServicePager - Lists a collection of the APIs associated with a gateway. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -315,7 +314,7 @@ func (client *GatewayAPIClient) listByServiceCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/gatewayapi_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/gatewayapi_client_example_test.go deleted file mode 100644 index 6d8be96e8f86..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/gatewayapi_client_example_test.go +++ /dev/null @@ -1,144 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGatewayApis.json -func ExampleGatewayAPIClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGatewayAPIClient().NewListByServicePager("rg1", "apimService1", "gw1", &armapimanagement.GatewayAPIClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.APICollection = armapimanagement.APICollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.APIContract{ - // { - // Name: to.Ptr("57681820a40f7eb6c49f6aca"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1/apis/57681820a40f7eb6c49f6aca"), - // Properties: &armapimanagement.APIContractProperties{ - // Description: to.Ptr("description_57681820a40f7eb6c49f6acc"), - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // Path: to.Ptr("suffix_57681820a40f7eb6c49f6ace"), - // DisplayName: to.Ptr("api_57681820a40f7eb6c49f6acb"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://contoso/57681820a40f7eb6c49f6acd"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGatewayApi.json -func ExampleGatewayAPIClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGatewayAPIClient().GetEntityTag(ctx, "rg1", "apimService1", "gw1", "api1", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGatewayApi.json -func ExampleGatewayAPIClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGatewayAPIClient().CreateOrUpdate(ctx, "rg1", "apimService1", "gw1", "echo-api", &armapimanagement.GatewayAPIClientCreateOrUpdateOptions{Parameters: &armapimanagement.AssociationContract{ - Properties: &armapimanagement.AssociationContractProperties{ - ProvisioningState: to.Ptr("created"), - }, - }, - }) - 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("echo-api"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1/apis/echo-api"), - // Properties: &armapimanagement.APIContractProperties{ - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // Path: to.Ptr(""), - // DisplayName: to.Ptr("EchoApi"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTP), - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("https://contoso.com/apis/echo"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGatewayApi.json -func ExampleGatewayAPIClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGatewayAPIClient().Delete(ctx, "rg1", "apimService1", "gw1", "echo-api", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/gatewaycertificateauthority_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/gatewaycertificateauthority_client.go index f57e57405909..b01913dcaae4 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/gatewaycertificateauthority_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/gatewaycertificateauthority_client.go @@ -30,8 +30,7 @@ type GatewayCertificateAuthorityClient struct { } // NewGatewayCertificateAuthorityClient creates a new instance of GatewayCertificateAuthorityClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewGatewayCertificateAuthorityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GatewayCertificateAuthorityClient, error) { @@ -49,8 +48,8 @@ func NewGatewayCertificateAuthorityClient(subscriptionID string, credential azco // CreateOrUpdate - Assign Certificate entity to Gateway entity as Certificate Authority. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -100,7 +99,7 @@ func (client *GatewayCertificateAuthorityClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -124,8 +123,8 @@ func (client *GatewayCertificateAuthorityClient) createOrUpdateHandleResponse(re // Delete - Remove relationship between Certificate Authority and Gateway entity. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -177,7 +176,7 @@ func (client *GatewayCertificateAuthorityClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -187,8 +186,8 @@ func (client *GatewayCertificateAuthorityClient) deleteCreateRequest(ctx context // Get - Get assigned Gateway Certificate Authority details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -238,7 +237,7 @@ func (client *GatewayCertificateAuthorityClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -258,8 +257,8 @@ func (client *GatewayCertificateAuthorityClient) getHandleResponse(resp *http.Re // GetEntityTag - Checks if Certificate entity is assigned to Gateway entity as Certificate Authority. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -309,7 +308,7 @@ func (client *GatewayCertificateAuthorityClient) getEntityTagCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -327,8 +326,8 @@ func (client *GatewayCertificateAuthorityClient) getEntityTagHandleResponse(resp // NewListByServicePager - Lists the collection of Certificate Authorities for the specified Gateway entity. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -395,7 +394,7 @@ func (client *GatewayCertificateAuthorityClient) listByServiceCreateRequest(ctx if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/gatewaycertificateauthority_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/gatewaycertificateauthority_client_example_test.go deleted file mode 100644 index 15cfa153a5a0..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/gatewaycertificateauthority_client_example_test.go +++ /dev/null @@ -1,160 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGatewayCertificateAuthorities.json -func ExampleGatewayCertificateAuthorityClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGatewayCertificateAuthorityClient().NewListByServicePager("rg1", "apimService1", "gw1", &armapimanagement.GatewayCertificateAuthorityClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.GatewayCertificateAuthorityCollection = armapimanagement.GatewayCertificateAuthorityCollection{ - // Value: []*armapimanagement.GatewayCertificateAuthorityContract{ - // { - // Name: to.Ptr("cert1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways/certificateAuthorities"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1/certificateAuthorities/cert1"), - // Properties: &armapimanagement.GatewayCertificateAuthorityContractProperties{ - // IsTrusted: to.Ptr(false), - // }, - // }, - // { - // Name: to.Ptr("cert2"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways/certificateAuthorities"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1/certificateAuthorities/cert2"), - // Properties: &armapimanagement.GatewayCertificateAuthorityContractProperties{ - // IsTrusted: to.Ptr(true), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGatewayCertificateAuthority.json -func ExampleGatewayCertificateAuthorityClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGatewayCertificateAuthorityClient().GetEntityTag(ctx, "rg1", "apimService1", "gw1", "cert1", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGatewayCertificateAuthority.json -func ExampleGatewayCertificateAuthorityClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGatewayCertificateAuthorityClient().Get(ctx, "rg1", "apimService1", "gw1", "cert1", 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.GatewayCertificateAuthorityContract = armapimanagement.GatewayCertificateAuthorityContract{ - // Name: to.Ptr("cert1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways/certificateAuthorities"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1/certificateAuthorities/cert1"), - // Properties: &armapimanagement.GatewayCertificateAuthorityContractProperties{ - // IsTrusted: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGatewayCertificateAuthority.json -func ExampleGatewayCertificateAuthorityClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGatewayCertificateAuthorityClient().CreateOrUpdate(ctx, "rg1", "apimService1", "gw1", "cert1", armapimanagement.GatewayCertificateAuthorityContract{ - Properties: &armapimanagement.GatewayCertificateAuthorityContractProperties{ - IsTrusted: to.Ptr(false), - }, - }, &armapimanagement.GatewayCertificateAuthorityClientCreateOrUpdateOptions{IfMatch: 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.GatewayCertificateAuthorityContract = armapimanagement.GatewayCertificateAuthorityContract{ - // Name: to.Ptr("cert1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways/certificateAuthorities"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1/certificateAuthorities/cert1"), - // Properties: &armapimanagement.GatewayCertificateAuthorityContractProperties{ - // IsTrusted: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGatewayCertificateAuthority.json -func ExampleGatewayCertificateAuthorityClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGatewayCertificateAuthorityClient().Delete(ctx, "rg1", "apimService1", "gw1", "default", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/gatewayhostnameconfiguration_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/gatewayhostnameconfiguration_client.go index be58df25a942..6246f58830e9 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/gatewayhostnameconfiguration_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/gatewayhostnameconfiguration_client.go @@ -30,8 +30,7 @@ type GatewayHostnameConfigurationClient struct { } // NewGatewayHostnameConfigurationClient creates a new instance of GatewayHostnameConfigurationClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewGatewayHostnameConfigurationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GatewayHostnameConfigurationClient, error) { @@ -49,8 +48,8 @@ func NewGatewayHostnameConfigurationClient(subscriptionID string, credential azc // CreateOrUpdate - Creates of updates hostname configuration for a Gateway. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -100,7 +99,7 @@ func (client *GatewayHostnameConfigurationClient) createOrUpdateCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -124,8 +123,8 @@ func (client *GatewayHostnameConfigurationClient) createOrUpdateHandleResponse(r // Delete - Deletes the specified hostname configuration from the specified Gateway. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -177,7 +176,7 @@ func (client *GatewayHostnameConfigurationClient) deleteCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -187,8 +186,8 @@ func (client *GatewayHostnameConfigurationClient) deleteCreateRequest(ctx contex // Get - Get details of a hostname configuration // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -238,7 +237,7 @@ func (client *GatewayHostnameConfigurationClient) getCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -258,8 +257,8 @@ func (client *GatewayHostnameConfigurationClient) getHandleResponse(resp *http.R // GetEntityTag - Checks that hostname configuration entity specified by identifier exists for specified Gateway entity. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -309,7 +308,7 @@ func (client *GatewayHostnameConfigurationClient) getEntityTagCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -327,8 +326,8 @@ func (client *GatewayHostnameConfigurationClient) getEntityTagHandleResponse(res // NewListByServicePager - Lists the collection of hostname configurations for the specified gateway. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - gatewayID - Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value // 'managed' @@ -395,7 +394,7 @@ func (client *GatewayHostnameConfigurationClient) listByServiceCreateRequest(ctx if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/gatewayhostnameconfiguration_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/gatewayhostnameconfiguration_client_example_test.go deleted file mode 100644 index b32bdd73acd2..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/gatewayhostnameconfiguration_client_example_test.go +++ /dev/null @@ -1,176 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGatewayHostnameConfigurations.json -func ExampleGatewayHostnameConfigurationClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGatewayHostnameConfigurationClient().NewListByServicePager("rg1", "apimService1", "gw1", &armapimanagement.GatewayHostnameConfigurationClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.GatewayHostnameConfigurationCollection = armapimanagement.GatewayHostnameConfigurationCollection{ - // Value: []*armapimanagement.GatewayHostnameConfigurationContract{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways/hostnameConfigurations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1/hostnameConfigurations/default"), - // Properties: &armapimanagement.GatewayHostnameConfigurationContractProperties{ - // CertificateID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1"), - // Hostname: to.Ptr("*"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // }, - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways/hostnameConfigurations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1/hostnameConfigurations/hostname1"), - // Properties: &armapimanagement.GatewayHostnameConfigurationContractProperties{ - // CertificateID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert2"), - // Hostname: to.Ptr("foo.bar.com"), - // NegotiateClientCertificate: to.Ptr(true), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGatewayHostnameConfiguration.json -func ExampleGatewayHostnameConfigurationClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGatewayHostnameConfigurationClient().GetEntityTag(ctx, "rg1", "apimService1", "gw1", "default", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGatewayHostnameConfiguration.json -func ExampleGatewayHostnameConfigurationClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGatewayHostnameConfigurationClient().Get(ctx, "rg1", "apimService1", "gw1", "default", 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.GatewayHostnameConfigurationContract = armapimanagement.GatewayHostnameConfigurationContract{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways/hostnameConfigurations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1/hostnameConfigurations/default"), - // Properties: &armapimanagement.GatewayHostnameConfigurationContractProperties{ - // CertificateID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1"), - // Hostname: to.Ptr("*"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGatewayHostnameConfiguration.json -func ExampleGatewayHostnameConfigurationClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGatewayHostnameConfigurationClient().CreateOrUpdate(ctx, "rg1", "apimService1", "gw1", "default", armapimanagement.GatewayHostnameConfigurationContract{ - Properties: &armapimanagement.GatewayHostnameConfigurationContractProperties{ - CertificateID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1"), - Hostname: to.Ptr("*"), - HTTP2Enabled: to.Ptr(true), - NegotiateClientCertificate: to.Ptr(false), - Tls10Enabled: to.Ptr(false), - Tls11Enabled: to.Ptr(false), - }, - }, &armapimanagement.GatewayHostnameConfigurationClientCreateOrUpdateOptions{IfMatch: 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.GatewayHostnameConfigurationContract = armapimanagement.GatewayHostnameConfigurationContract{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.ApiManagement/service/gateways/hostnameConfigurations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1/hostnameConfigurations/default"), - // Properties: &armapimanagement.GatewayHostnameConfigurationContractProperties{ - // CertificateID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1"), - // Hostname: to.Ptr("*"), - // HTTP2Enabled: to.Ptr(true), - // NegotiateClientCertificate: to.Ptr(false), - // Tls10Enabled: to.Ptr(false), - // Tls11Enabled: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGatewayHostnameConfiguration.json -func ExampleGatewayHostnameConfigurationClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGatewayHostnameConfigurationClient().Delete(ctx, "rg1", "apimService1", "gw1", "default", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/globalschema_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/globalschema_client.go index e5b5918a9d7d..67a96be2eb9d 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/globalschema_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/globalschema_client.go @@ -30,8 +30,7 @@ type GlobalSchemaClient struct { } // NewGlobalSchemaClient creates a new instance of GlobalSchemaClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewGlobalSchemaClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GlobalSchemaClient, error) { @@ -49,8 +48,8 @@ func NewGlobalSchemaClient(subscriptionID string, credential azcore.TokenCredent // BeginCreateOrUpdate - Creates new or updates existing specified Schema of the API Management service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - schemaID - Schema id identifier. Must be unique in the current API Management service instance. // - parameters - Create or update parameters. @@ -73,7 +72,7 @@ func (client *GlobalSchemaClient) BeginCreateOrUpdate(ctx context.Context, resou // CreateOrUpdate - Creates new or updates existing specified Schema of the API Management service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *GlobalSchemaClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, schemaID string, parameters GlobalSchemaContract, options *GlobalSchemaClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, schemaID, parameters, options) if err != nil { @@ -113,7 +112,7 @@ func (client *GlobalSchemaClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -125,8 +124,8 @@ func (client *GlobalSchemaClient) createOrUpdateCreateRequest(ctx context.Contex // Delete - Deletes specific Schema. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - schemaID - Schema id identifier. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -171,7 +170,7 @@ func (client *GlobalSchemaClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -181,8 +180,8 @@ func (client *GlobalSchemaClient) deleteCreateRequest(ctx context.Context, resou // Get - Gets the details of the Schema specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - schemaID - Schema id identifier. Must be unique in the current API Management service instance. // - options - GlobalSchemaClientGetOptions contains the optional parameters for the GlobalSchemaClient.Get method. @@ -225,7 +224,7 @@ func (client *GlobalSchemaClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -245,8 +244,8 @@ func (client *GlobalSchemaClient) getHandleResponse(resp *http.Response) (Global // GetEntityTag - Gets the entity state (Etag) version of the Schema specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - schemaID - Schema id identifier. Must be unique in the current API Management service instance. // - options - GlobalSchemaClientGetEntityTagOptions contains the optional parameters for the GlobalSchemaClient.GetEntityTag @@ -290,7 +289,7 @@ func (client *GlobalSchemaClient) getEntityTagCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -308,8 +307,8 @@ func (client *GlobalSchemaClient) getEntityTagHandleResponse(resp *http.Response // NewListByServicePager - Lists a collection of schemas registered with service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - GlobalSchemaClientListByServiceOptions contains the optional parameters for the GlobalSchemaClient.NewListByServicePager // method. @@ -370,7 +369,7 @@ func (client *GlobalSchemaClient) listByServiceCreateRequest(ctx context.Context if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/globalschema_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/globalschema_client_example_test.go deleted file mode 100644 index c14aabd2e92d..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/globalschema_client_example_test.go +++ /dev/null @@ -1,325 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGlobalSchemas.json -func ExampleGlobalSchemaClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGlobalSchemaClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.GlobalSchemaClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.GlobalSchemaCollection = armapimanagement.GlobalSchemaCollection{ - // Count: to.Ptr[int64](2), - // Value: []*armapimanagement.GlobalSchemaContract{ - // { - // Name: to.Ptr("schema1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/schemas"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1"), - // Properties: &armapimanagement.GlobalSchemaContractProperties{ - // Description: to.Ptr("sample schema description"), - // SchemaType: to.Ptr(armapimanagement.SchemaTypeXML), - // Value: "\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", - // }, - // }, - // { - // Name: to.Ptr("schema2"), - // Type: to.Ptr("Microsoft.ApiManagement/service/schemas"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema2"), - // Properties: &armapimanagement.GlobalSchemaContractProperties{ - // Description: to.Ptr("sample schema description"), - // Document: map[string]any{ - // "type": "object", - // "$id": "https://example.com/person.schema.json", - // "$schema": "https://json-schema.org/draft/2020-12/schema", - // "properties":map[string]any{ - // "age":map[string]any{ - // "type": "integer", - // "description": "Age in years which must be equal to or greater than zero.", - // "minimum": float64(0), - // }, - // "firstName":map[string]any{ - // "type": "string", - // "description": "The person's first name.", - // }, - // "lastName":map[string]any{ - // "type": "string", - // "description": "The person's last name.", - // }, - // }, - // "title": "Person", - // }, - // SchemaType: to.Ptr(armapimanagement.SchemaTypeJSON), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGlobalSchema.json -func ExampleGlobalSchemaClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGlobalSchemaClient().GetEntityTag(ctx, "rg1", "apimService1", "myschema", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGlobalSchema1.json -func ExampleGlobalSchemaClient_Get_apiManagementGetSchema1() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGlobalSchemaClient().Get(ctx, "rg1", "apimService1", "schema1", 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.GlobalSchemaContract = armapimanagement.GlobalSchemaContract{ - // Name: to.Ptr("schema1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/schemas"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1"), - // Properties: &armapimanagement.GlobalSchemaContractProperties{ - // Description: to.Ptr("sample schema description"), - // SchemaType: to.Ptr(armapimanagement.SchemaTypeXML), - // Value: "\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGlobalSchema2.json -func ExampleGlobalSchemaClient_Get_apiManagementGetSchema2() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGlobalSchemaClient().Get(ctx, "rg1", "apimService1", "schema2", 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.GlobalSchemaContract = armapimanagement.GlobalSchemaContract{ - // Name: to.Ptr("schema2"), - // Type: to.Ptr("Microsoft.ApiManagement/service/schemas"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema2"), - // Properties: &armapimanagement.GlobalSchemaContractProperties{ - // Description: to.Ptr("sample schema description"), - // Document: map[string]any{ - // "type": "object", - // "$id": "https://example.com/person.schema.json", - // "$schema": "https://json-schema.org/draft/2020-12/schema", - // "properties":map[string]any{ - // "age":map[string]any{ - // "type": "integer", - // "description": "Age in years which must be equal to or greater than zero.", - // "minimum": float64(0), - // }, - // "firstName":map[string]any{ - // "type": "string", - // "description": "The person's first name.", - // }, - // "lastName":map[string]any{ - // "type": "string", - // "description": "The person's last name.", - // }, - // }, - // "title": "Person", - // }, - // SchemaType: to.Ptr(armapimanagement.SchemaTypeJSON), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGlobalSchema1.json -func ExampleGlobalSchemaClient_BeginCreateOrUpdate_apiManagementCreateSchema1() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGlobalSchemaClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "schema1", armapimanagement.GlobalSchemaContract{ - Properties: &armapimanagement.GlobalSchemaContractProperties{ - Description: to.Ptr("sample schema description"), - SchemaType: to.Ptr(armapimanagement.SchemaTypeXML), - Value: "\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", - }, - }, &armapimanagement.GlobalSchemaClientBeginCreateOrUpdateOptions{IfMatch: 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.GlobalSchemaContract = armapimanagement.GlobalSchemaContract{ - // Name: to.Ptr("schema1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/schemas"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1"), - // Properties: &armapimanagement.GlobalSchemaContractProperties{ - // Description: to.Ptr("sample schema description"), - // SchemaType: to.Ptr(armapimanagement.SchemaTypeXML), - // Value: "\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGlobalSchema2.json -func ExampleGlobalSchemaClient_BeginCreateOrUpdate_apiManagementCreateSchema2() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGlobalSchemaClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "schema1", armapimanagement.GlobalSchemaContract{ - Properties: &armapimanagement.GlobalSchemaContractProperties{ - Description: to.Ptr("sample schema description"), - Document: map[string]any{ - "type": "object", - "$id": "https://example.com/person.schema.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "properties": map[string]any{ - "age": map[string]any{ - "type": "integer", - "description": "Age in years which must be equal to or greater than zero.", - "minimum": float64(0), - }, - "firstName": map[string]any{ - "type": "string", - "description": "The person's first name.", - }, - "lastName": map[string]any{ - "type": "string", - "description": "The person's last name.", - }, - }, - "title": "Person", - }, - SchemaType: to.Ptr(armapimanagement.SchemaTypeJSON), - }, - }, &armapimanagement.GlobalSchemaClientBeginCreateOrUpdateOptions{IfMatch: 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.GlobalSchemaContract = armapimanagement.GlobalSchemaContract{ - // Name: to.Ptr("schema1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/schemas"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1"), - // Properties: &armapimanagement.GlobalSchemaContractProperties{ - // Description: to.Ptr("sample schema description"), - // Document: map[string]any{ - // "type": "object", - // "$id": "https://example.com/person.schema.json", - // "$schema": "https://json-schema.org/draft/2020-12/schema", - // "properties":map[string]any{ - // "age":map[string]any{ - // "type": "integer", - // "description": "Age in years which must be equal to or greater than zero.", - // "minimum": float64(0), - // }, - // "firstName":map[string]any{ - // "type": "string", - // "description": "The person's first name.", - // }, - // "lastName":map[string]any{ - // "type": "string", - // "description": "The person's last name.", - // }, - // }, - // "title": "Person", - // }, - // SchemaType: to.Ptr(armapimanagement.SchemaTypeJSON), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGlobalSchema.json -func ExampleGlobalSchemaClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGlobalSchemaClient().Delete(ctx, "rg1", "apimService1", "schema1", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/go.mod b/sdk/resourcemanager/apimanagement/armapimanagement/go.mod index eb864e472f10..39d01d9e6668 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/go.mod +++ b/sdk/resourcemanager/apimanagement/armapimanagement/go.mod @@ -1,16 +1,16 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2 go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 github.com/stretchr/testify v1.7.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/graphqlapiresolver_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/graphqlapiresolver_client.go new file mode 100644 index 000000000000..06a411a99a65 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/graphqlapiresolver_client.go @@ -0,0 +1,486 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// GraphQLAPIResolverClient contains the methods for the GraphQLAPIResolver group. +// Don't use this type directly, use NewGraphQLAPIResolverClient() instead. +type GraphQLAPIResolverClient struct { + internal *arm.Client + subscriptionID string +} + +// NewGraphQLAPIResolverClient creates a new instance of GraphQLAPIResolverClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewGraphQLAPIResolverClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GraphQLAPIResolverClient, error) { + cl, err := arm.NewClient(moduleName+".GraphQLAPIResolverClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GraphQLAPIResolverClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates a new resolver in the GraphQL API or updates an existing one. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - resolverID - Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. +// - parameters - Create parameters. +// - options - GraphQLAPIResolverClientCreateOrUpdateOptions contains the optional parameters for the GraphQLAPIResolverClient.CreateOrUpdate +// method. +func (client *GraphQLAPIResolverClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, parameters ResolverContract, options *GraphQLAPIResolverClientCreateOrUpdateOptions) (GraphQLAPIResolverClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, apiID, resolverID, parameters, options) + if err != nil { + return GraphQLAPIResolverClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GraphQLAPIResolverClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return GraphQLAPIResolverClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *GraphQLAPIResolverClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, parameters ResolverContract, options *GraphQLAPIResolverClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if resolverID == "" { + return nil, errors.New("parameter resolverID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resolverId}", url.PathEscape(resolverID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *GraphQLAPIResolverClient) createOrUpdateHandleResponse(resp *http.Response) (GraphQLAPIResolverClientCreateOrUpdateResponse, error) { + result := GraphQLAPIResolverClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ResolverContract); err != nil { + return GraphQLAPIResolverClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified resolver in the GraphQL API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - resolverID - Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - GraphQLAPIResolverClientDeleteOptions contains the optional parameters for the GraphQLAPIResolverClient.Delete +// method. +func (client *GraphQLAPIResolverClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, ifMatch string, options *GraphQLAPIResolverClientDeleteOptions) (GraphQLAPIResolverClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, apiID, resolverID, ifMatch, options) + if err != nil { + return GraphQLAPIResolverClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GraphQLAPIResolverClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return GraphQLAPIResolverClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return GraphQLAPIResolverClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *GraphQLAPIResolverClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, ifMatch string, options *GraphQLAPIResolverClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if resolverID == "" { + return nil, errors.New("parameter resolverID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resolverId}", url.PathEscape(resolverID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the GraphQL API Resolver specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - resolverID - Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. +// - options - GraphQLAPIResolverClientGetOptions contains the optional parameters for the GraphQLAPIResolverClient.Get method. +func (client *GraphQLAPIResolverClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, options *GraphQLAPIResolverClientGetOptions) (GraphQLAPIResolverClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, apiID, resolverID, options) + if err != nil { + return GraphQLAPIResolverClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GraphQLAPIResolverClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GraphQLAPIResolverClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *GraphQLAPIResolverClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, options *GraphQLAPIResolverClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if resolverID == "" { + return nil, errors.New("parameter resolverID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resolverId}", url.PathEscape(resolverID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GraphQLAPIResolverClient) getHandleResponse(resp *http.Response) (GraphQLAPIResolverClientGetResponse, error) { + result := GraphQLAPIResolverClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ResolverContract); err != nil { + return GraphQLAPIResolverClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the GraphQL API resolver specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - resolverID - Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. +// - options - GraphQLAPIResolverClientGetEntityTagOptions contains the optional parameters for the GraphQLAPIResolverClient.GetEntityTag +// method. +func (client *GraphQLAPIResolverClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, options *GraphQLAPIResolverClientGetEntityTagOptions) (GraphQLAPIResolverClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, apiID, resolverID, options) + if err != nil { + return GraphQLAPIResolverClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GraphQLAPIResolverClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GraphQLAPIResolverClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *GraphQLAPIResolverClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, options *GraphQLAPIResolverClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if resolverID == "" { + return nil, errors.New("parameter resolverID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resolverId}", url.PathEscape(resolverID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *GraphQLAPIResolverClient) getEntityTagHandleResponse(resp *http.Response) (GraphQLAPIResolverClientGetEntityTagResponse, error) { + result := GraphQLAPIResolverClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByAPIPager - Lists a collection of the resolvers for the specified GraphQL API. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - options - GraphQLAPIResolverClientListByAPIOptions contains the optional parameters for the GraphQLAPIResolverClient.NewListByAPIPager +// method. +func (client *GraphQLAPIResolverClient) NewListByAPIPager(resourceGroupName string, serviceName string, apiID string, options *GraphQLAPIResolverClientListByAPIOptions) *runtime.Pager[GraphQLAPIResolverClientListByAPIResponse] { + return runtime.NewPager(runtime.PagingHandler[GraphQLAPIResolverClientListByAPIResponse]{ + More: func(page GraphQLAPIResolverClientListByAPIResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GraphQLAPIResolverClientListByAPIResponse) (GraphQLAPIResolverClientListByAPIResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByAPICreateRequest(ctx, resourceGroupName, serviceName, apiID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GraphQLAPIResolverClientListByAPIResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GraphQLAPIResolverClientListByAPIResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GraphQLAPIResolverClientListByAPIResponse{}, runtime.NewResponseError(resp) + } + return client.listByAPIHandleResponse(resp) + }, + }) +} + +// listByAPICreateRequest creates the ListByAPI request. +func (client *GraphQLAPIResolverClient) listByAPICreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *GraphQLAPIResolverClientListByAPIOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByAPIHandleResponse handles the ListByAPI response. +func (client *GraphQLAPIResolverClient) listByAPIHandleResponse(resp *http.Response) (GraphQLAPIResolverClientListByAPIResponse, error) { + result := GraphQLAPIResolverClientListByAPIResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResolverCollection); err != nil { + return GraphQLAPIResolverClientListByAPIResponse{}, err + } + return result, nil +} + +// Update - Updates the details of the resolver in the GraphQL API specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - resolverID - Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - GraphQL API Resolver Update parameters. +// - options - GraphQLAPIResolverClientUpdateOptions contains the optional parameters for the GraphQLAPIResolverClient.Update +// method. +func (client *GraphQLAPIResolverClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, ifMatch string, parameters ResolverUpdateContract, options *GraphQLAPIResolverClientUpdateOptions) (GraphQLAPIResolverClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, apiID, resolverID, ifMatch, parameters, options) + if err != nil { + return GraphQLAPIResolverClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GraphQLAPIResolverClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GraphQLAPIResolverClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *GraphQLAPIResolverClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, ifMatch string, parameters ResolverUpdateContract, options *GraphQLAPIResolverClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if resolverID == "" { + return nil, errors.New("parameter resolverID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resolverId}", url.PathEscape(resolverID)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *GraphQLAPIResolverClient) updateHandleResponse(resp *http.Response) (GraphQLAPIResolverClientUpdateResponse, error) { + result := GraphQLAPIResolverClientUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ResolverContract); err != nil { + return GraphQLAPIResolverClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/graphqlapiresolverpolicy_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/graphqlapiresolverpolicy_client.go new file mode 100644 index 000000000000..c9188077a731 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/graphqlapiresolverpolicy_client.go @@ -0,0 +1,429 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// GraphQLAPIResolverPolicyClient contains the methods for the GraphQLAPIResolverPolicy group. +// Don't use this type directly, use NewGraphQLAPIResolverPolicyClient() instead. +type GraphQLAPIResolverPolicyClient struct { + internal *arm.Client + subscriptionID string +} + +// NewGraphQLAPIResolverPolicyClient creates a new instance of GraphQLAPIResolverPolicyClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewGraphQLAPIResolverPolicyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GraphQLAPIResolverPolicyClient, error) { + cl, err := arm.NewClient(moduleName+".GraphQLAPIResolverPolicyClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GraphQLAPIResolverPolicyClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates policy configuration for the GraphQL API Resolver level. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - resolverID - Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - parameters - The policy contents to apply. +// - options - GraphQLAPIResolverPolicyClientCreateOrUpdateOptions contains the optional parameters for the GraphQLAPIResolverPolicyClient.CreateOrUpdate +// method. +func (client *GraphQLAPIResolverPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, policyID PolicyIDName, parameters PolicyContract, options *GraphQLAPIResolverPolicyClientCreateOrUpdateOptions) (GraphQLAPIResolverPolicyClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, apiID, resolverID, policyID, parameters, options) + if err != nil { + return GraphQLAPIResolverPolicyClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GraphQLAPIResolverPolicyClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return GraphQLAPIResolverPolicyClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *GraphQLAPIResolverPolicyClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, policyID PolicyIDName, parameters PolicyContract, options *GraphQLAPIResolverPolicyClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if resolverID == "" { + return nil, errors.New("parameter resolverID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resolverId}", url.PathEscape(resolverID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *GraphQLAPIResolverPolicyClient) createOrUpdateHandleResponse(resp *http.Response) (GraphQLAPIResolverPolicyClientCreateOrUpdateResponse, error) { + result := GraphQLAPIResolverPolicyClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { + return GraphQLAPIResolverPolicyClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the policy configuration at the GraphQL Api Resolver. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - resolverID - Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - GraphQLAPIResolverPolicyClientDeleteOptions contains the optional parameters for the GraphQLAPIResolverPolicyClient.Delete +// method. +func (client *GraphQLAPIResolverPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, policyID PolicyIDName, ifMatch string, options *GraphQLAPIResolverPolicyClientDeleteOptions) (GraphQLAPIResolverPolicyClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, apiID, resolverID, policyID, ifMatch, options) + if err != nil { + return GraphQLAPIResolverPolicyClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GraphQLAPIResolverPolicyClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return GraphQLAPIResolverPolicyClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return GraphQLAPIResolverPolicyClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *GraphQLAPIResolverPolicyClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, policyID PolicyIDName, ifMatch string, options *GraphQLAPIResolverPolicyClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if resolverID == "" { + return nil, errors.New("parameter resolverID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resolverId}", url.PathEscape(resolverID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the policy configuration at the GraphQL API Resolver level. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - resolverID - Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - options - GraphQLAPIResolverPolicyClientGetOptions contains the optional parameters for the GraphQLAPIResolverPolicyClient.Get +// method. +func (client *GraphQLAPIResolverPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, policyID PolicyIDName, options *GraphQLAPIResolverPolicyClientGetOptions) (GraphQLAPIResolverPolicyClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, apiID, resolverID, policyID, options) + if err != nil { + return GraphQLAPIResolverPolicyClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GraphQLAPIResolverPolicyClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GraphQLAPIResolverPolicyClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *GraphQLAPIResolverPolicyClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, policyID PolicyIDName, options *GraphQLAPIResolverPolicyClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if resolverID == "" { + return nil, errors.New("parameter resolverID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resolverId}", url.PathEscape(resolverID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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() + if options != nil && options.Format != nil { + reqQP.Set("format", string(*options.Format)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GraphQLAPIResolverPolicyClient) getHandleResponse(resp *http.Response) (GraphQLAPIResolverPolicyClientGetResponse, error) { + result := GraphQLAPIResolverPolicyClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { + return GraphQLAPIResolverPolicyClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the GraphQL API resolver policy specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - resolverID - Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - options - GraphQLAPIResolverPolicyClientGetEntityTagOptions contains the optional parameters for the GraphQLAPIResolverPolicyClient.GetEntityTag +// method. +func (client *GraphQLAPIResolverPolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, policyID PolicyIDName, options *GraphQLAPIResolverPolicyClientGetEntityTagOptions) (GraphQLAPIResolverPolicyClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, apiID, resolverID, policyID, options) + if err != nil { + return GraphQLAPIResolverPolicyClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GraphQLAPIResolverPolicyClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GraphQLAPIResolverPolicyClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *GraphQLAPIResolverPolicyClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, policyID PolicyIDName, options *GraphQLAPIResolverPolicyClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if resolverID == "" { + return nil, errors.New("parameter resolverID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resolverId}", url.PathEscape(resolverID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *GraphQLAPIResolverPolicyClient) getEntityTagHandleResponse(resp *http.Response) (GraphQLAPIResolverPolicyClientGetEntityTagResponse, error) { + result := GraphQLAPIResolverPolicyClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByResolverPager - Get the list of policy configuration at the GraphQL API Resolver level. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - resolverID - Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. +// - options - GraphQLAPIResolverPolicyClientListByResolverOptions contains the optional parameters for the GraphQLAPIResolverPolicyClient.NewListByResolverPager +// method. +func (client *GraphQLAPIResolverPolicyClient) NewListByResolverPager(resourceGroupName string, serviceName string, apiID string, resolverID string, options *GraphQLAPIResolverPolicyClientListByResolverOptions) *runtime.Pager[GraphQLAPIResolverPolicyClientListByResolverResponse] { + return runtime.NewPager(runtime.PagingHandler[GraphQLAPIResolverPolicyClientListByResolverResponse]{ + More: func(page GraphQLAPIResolverPolicyClientListByResolverResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GraphQLAPIResolverPolicyClientListByResolverResponse) (GraphQLAPIResolverPolicyClientListByResolverResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResolverCreateRequest(ctx, resourceGroupName, serviceName, apiID, resolverID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GraphQLAPIResolverPolicyClientListByResolverResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GraphQLAPIResolverPolicyClientListByResolverResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GraphQLAPIResolverPolicyClientListByResolverResponse{}, runtime.NewResponseError(resp) + } + return client.listByResolverHandleResponse(resp) + }, + }) +} + +// listByResolverCreateRequest creates the ListByResolver request. +func (client *GraphQLAPIResolverPolicyClient) listByResolverCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, resolverID string, options *GraphQLAPIResolverPolicyClientListByResolverOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if resolverID == "" { + return nil, errors.New("parameter resolverID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resolverId}", url.PathEscape(resolverID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResolverHandleResponse handles the ListByResolver response. +func (client *GraphQLAPIResolverPolicyClient) listByResolverHandleResponse(resp *http.Response) (GraphQLAPIResolverPolicyClientListByResolverResponse, error) { + result := GraphQLAPIResolverPolicyClientListByResolverResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyCollection); err != nil { + return GraphQLAPIResolverPolicyClientListByResolverResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/group_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/group_client.go index ffeba7d48fa7..9cb5a9bd7f1a 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/group_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/group_client.go @@ -30,8 +30,7 @@ type GroupClient struct { } // NewGroupClient creates a new instance of GroupClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GroupClient, error) { @@ -49,8 +48,8 @@ func NewGroupClient(subscriptionID string, credential azcore.TokenCredential, op // CreateOrUpdate - Creates or Updates a group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - groupID - Group identifier. Must be unique in the current API Management service instance. // - parameters - Create parameters. @@ -94,7 +93,7 @@ func (client *GroupClient) createOrUpdateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -118,8 +117,8 @@ func (client *GroupClient) createOrUpdateHandleResponse(resp *http.Response) (Gr // Delete - Deletes specific group of the API Management service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - groupID - Group identifier. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -164,7 +163,7 @@ func (client *GroupClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -174,8 +173,8 @@ func (client *GroupClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Gets the details of the group specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - groupID - Group identifier. Must be unique in the current API Management service instance. // - options - GroupClientGetOptions contains the optional parameters for the GroupClient.Get method. @@ -218,7 +217,7 @@ func (client *GroupClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -238,8 +237,8 @@ func (client *GroupClient) getHandleResponse(resp *http.Response) (GroupClientGe // GetEntityTag - Gets the entity state (Etag) version of the group specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - groupID - Group identifier. Must be unique in the current API Management service instance. // - options - GroupClientGetEntityTagOptions contains the optional parameters for the GroupClient.GetEntityTag method. @@ -282,7 +281,7 @@ func (client *GroupClient) getEntityTagCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -300,8 +299,8 @@ func (client *GroupClient) getEntityTagHandleResponse(resp *http.Response) (Grou // NewListByServicePager - Lists a collection of groups defined within a service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - GroupClientListByServiceOptions contains the optional parameters for the GroupClient.NewListByServicePager method. func (client *GroupClient) NewListByServicePager(resourceGroupName string, serviceName string, options *GroupClientListByServiceOptions) *runtime.Pager[GroupClientListByServiceResponse] { @@ -361,7 +360,7 @@ func (client *GroupClient) listByServiceCreateRequest(ctx context.Context, resou if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -379,8 +378,8 @@ func (client *GroupClient) listByServiceHandleResponse(resp *http.Response) (Gro // Update - Updates the details of the group specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - groupID - Group identifier. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -426,7 +425,7 @@ func (client *GroupClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/group_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/group_client_example_test.go deleted file mode 100644 index 851297dbd73e..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/group_client_example_test.go +++ /dev/null @@ -1,269 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGroups.json -func ExampleGroupClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGroupClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.GroupClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.GroupCollection = armapimanagement.GroupCollection{ - // Count: to.Ptr[int64](4), - // Value: []*armapimanagement.GroupContract{ - // { - // Name: to.Ptr("5600b59375ff190048020001"), - // Type: to.Ptr("Microsoft.ApiManagement/service/groups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/5600b59375ff190048020001"), - // Properties: &armapimanagement.GroupContractProperties{ - // Type: to.Ptr(armapimanagement.GroupTypeSystem), - // Description: to.Ptr("Administrators is a built-in group. Its membership is managed by the system. Microsoft Azure subscription administrators fall into this group."), - // BuiltIn: to.Ptr(true), - // DisplayName: to.Ptr("Administrators"), - // }, - // }, - // { - // Name: to.Ptr("59306a29e4bbd510dc24e5f9"), - // Type: to.Ptr("Microsoft.ApiManagement/service/groups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/59306a29e4bbd510dc24e5f9"), - // Properties: &armapimanagement.GroupContractProperties{ - // Type: to.Ptr(armapimanagement.GroupTypeExternal), - // Description: to.Ptr("awesome group of people"), - // BuiltIn: to.Ptr(false), - // DisplayName: to.Ptr("AwesomeGroup (samiraad.onmicrosoft.com)"), - // ExternalID: to.Ptr("aad://samiraad.onmicrosoft.com/groups/3773adf4-032e-4d25-9988-eaff9ca72eca"), - // }, - // }, - // { - // Name: to.Ptr("5600b59375ff190048020002"), - // Type: to.Ptr("Microsoft.ApiManagement/service/groups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/5600b59375ff190048020002"), - // Properties: &armapimanagement.GroupContractProperties{ - // Type: to.Ptr(armapimanagement.GroupTypeSystem), - // Description: to.Ptr("Developers is a built-in group. Its membership is managed by the system. Signed-in users fall into this group."), - // BuiltIn: to.Ptr(true), - // DisplayName: to.Ptr("Developers"), - // }, - // }, - // { - // Name: to.Ptr("5600b59375ff190048020003"), - // Type: to.Ptr("Microsoft.ApiManagement/service/groups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/5600b59375ff190048020003"), - // Properties: &armapimanagement.GroupContractProperties{ - // Type: to.Ptr(armapimanagement.GroupTypeSystem), - // Description: to.Ptr("Guests is a built-in group. Its membership is managed by the system. Unauthenticated users visiting the developer portal fall into this group."), - // BuiltIn: to.Ptr(true), - // DisplayName: to.Ptr("Guests"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGroup.json -func ExampleGroupClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGroupClient().GetEntityTag(ctx, "rg1", "apimService1", "59306a29e4bbd510dc24e5f9", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGroup.json -func ExampleGroupClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupClient().Get(ctx, "rg1", "apimService1", "59306a29e4bbd510dc24e5f9", 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.GroupContract = armapimanagement.GroupContract{ - // Name: to.Ptr("59306a29e4bbd510dc24e5f9"), - // Type: to.Ptr("Microsoft.ApiManagement/service/groups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/59306a29e4bbd510dc24e5f9"), - // Properties: &armapimanagement.GroupContractProperties{ - // Type: to.Ptr(armapimanagement.GroupTypeExternal), - // Description: to.Ptr("awesome group of people"), - // BuiltIn: to.Ptr(false), - // DisplayName: to.Ptr("AwesomeGroup (samiraad.onmicrosoft.com)"), - // ExternalID: to.Ptr("aad://samiraad.onmicrosoft.com/groups/3773adf4-032e-4d25-9988-eaff9ca72eca"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGroup.json -func ExampleGroupClient_CreateOrUpdate_apiManagementCreateGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupClient().CreateOrUpdate(ctx, "rg1", "apimService1", "tempgroup", armapimanagement.GroupCreateParameters{ - Properties: &armapimanagement.GroupCreateParametersProperties{ - DisplayName: to.Ptr("temp group"), - }, - }, &armapimanagement.GroupClientCreateOrUpdateOptions{IfMatch: 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.GroupContract = armapimanagement.GroupContract{ - // Name: to.Ptr("tempgroup"), - // Type: to.Ptr("Microsoft.ApiManagement/service/groups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/tempgroup"), - // Properties: &armapimanagement.GroupContractProperties{ - // Type: to.Ptr(armapimanagement.GroupTypeCustom), - // DisplayName: to.Ptr("temp group"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGroupExternal.json -func ExampleGroupClient_CreateOrUpdate_apiManagementCreateGroupExternal() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupClient().CreateOrUpdate(ctx, "rg1", "apimService1", "aadGroup", armapimanagement.GroupCreateParameters{ - Properties: &armapimanagement.GroupCreateParametersProperties{ - Type: to.Ptr(armapimanagement.GroupTypeExternal), - Description: to.Ptr("new group to test"), - DisplayName: to.Ptr("NewGroup (samiraad.onmicrosoft.com)"), - ExternalID: to.Ptr("aad://samiraad.onmicrosoft.com/groups/83cf2753-5831-4675-bc0e-2f8dc067c58d"), - }, - }, &armapimanagement.GroupClientCreateOrUpdateOptions{IfMatch: 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.GroupContract = armapimanagement.GroupContract{ - // Name: to.Ptr("aadGroup"), - // Type: to.Ptr("Microsoft.ApiManagement/service/groups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/aadGroup"), - // Properties: &armapimanagement.GroupContractProperties{ - // Type: to.Ptr(armapimanagement.GroupTypeExternal), - // Description: to.Ptr("new group to test"), - // DisplayName: to.Ptr("NewGroup (samiraad.onmicrosoft.com)"), - // ExternalID: to.Ptr("aad://samiraad.onmicrosoft.com/groups/83cf2753-5831-4675-bc0e-2f8dc067c58d"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateGroup.json -func ExampleGroupClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupClient().Update(ctx, "rg1", "apimService1", "tempgroup", "*", armapimanagement.GroupUpdateParameters{ - Properties: &armapimanagement.GroupUpdateParametersProperties{ - DisplayName: to.Ptr("temp group"), - }, - }, 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.GroupContract = armapimanagement.GroupContract{ - // Name: to.Ptr("tempgroup"), - // Type: to.Ptr("Microsoft.ApiManagement/service/groups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/tempgroup"), - // Properties: &armapimanagement.GroupContractProperties{ - // Type: to.Ptr(armapimanagement.GroupTypeExternal), - // Description: to.Ptr("awesome group of people"), - // BuiltIn: to.Ptr(false), - // DisplayName: to.Ptr("tempgroup"), - // ExternalID: to.Ptr("aad://samiraad.onmicrosoft.com/groups/3773adf4-032e-4d25-9988-eaff9ca72eca"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGroup.json -func ExampleGroupClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGroupClient().Delete(ctx, "rg1", "apimService1", "aadGroup", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/groupuser_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/groupuser_client.go index 78b782fc7a2b..2ab322060f1b 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/groupuser_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/groupuser_client.go @@ -30,8 +30,7 @@ type GroupUserClient struct { } // NewGroupUserClient creates a new instance of GroupUserClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewGroupUserClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GroupUserClient, error) { @@ -48,8 +47,8 @@ func NewGroupUserClient(subscriptionID string, credential azcore.TokenCredential // CheckEntityExists - Checks that user entity specified by identifier is associated with the group entity. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - groupID - Group identifier. Must be unique in the current API Management service instance. // - userID - User identifier. Must be unique in the current API Management service instance. @@ -98,7 +97,7 @@ func (client *GroupUserClient) checkEntityExistsCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -107,8 +106,8 @@ func (client *GroupUserClient) checkEntityExistsCreateRequest(ctx context.Contex // Create - Add existing user to existing group // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - groupID - Group identifier. Must be unique in the current API Management service instance. // - userID - User identifier. Must be unique in the current API Management service instance. @@ -156,7 +155,7 @@ func (client *GroupUserClient) createCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -174,8 +173,8 @@ func (client *GroupUserClient) createHandleResponse(resp *http.Response) (GroupU // Delete - Remove existing user from existing group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - groupID - Group identifier. Must be unique in the current API Management service instance. // - userID - User identifier. Must be unique in the current API Management service instance. @@ -223,7 +222,7 @@ func (client *GroupUserClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -231,8 +230,8 @@ func (client *GroupUserClient) deleteCreateRequest(ctx context.Context, resource // NewListPager - Lists a collection of user entities associated with the group. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - groupID - Group identifier. Must be unique in the current API Management service instance. // - options - GroupUserClientListOptions contains the optional parameters for the GroupUserClient.NewListPager method. @@ -297,7 +296,7 @@ func (client *GroupUserClient) listCreateRequest(ctx context.Context, resourceGr if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/groupuser_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/groupuser_client_example_test.go deleted file mode 100644 index d08c356e941b..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/groupuser_client_example_test.go +++ /dev/null @@ -1,138 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGroupUsers.json -func ExampleGroupUserClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGroupUserClient().NewListPager("rg1", "apimService1", "57d2ef278aa04f0888cba3f3", &armapimanagement.GroupUserClientListOptions{Filter: nil, - Top: nil, - Skip: 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.UserCollection = armapimanagement.UserCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.UserContract{ - // { - // Name: to.Ptr("armTemplateUser1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/groups/users"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/kjoshiarmTemplateUser1"), - // Properties: &armapimanagement.UserContractProperties{ - // Identities: []*armapimanagement.UserIdentityContract{ - // { - // ID: to.Ptr("user1@live.com"), - // Provider: to.Ptr("Basic"), - // }}, - // Note: to.Ptr("note for user 1"), - // State: to.Ptr(armapimanagement.UserStateActive), - // Email: to.Ptr("user1@live.com"), - // FirstName: to.Ptr("user1"), - // LastName: to.Ptr("lastname1"), - // RegistrationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-31T18:54:41.447Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGroupUser.json -func ExampleGroupUserClient_CheckEntityExists() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGroupUserClient().CheckEntityExists(ctx, "rg1", "apimService1", "59306a29e4bbd510dc24e5f9", "5931a75ae4bbd512a88c680b", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGroupUser.json -func ExampleGroupUserClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupUserClient().Create(ctx, "rg1", "apimService1", "tempgroup", "59307d350af58404d8a26300", 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.UserContract = armapimanagement.UserContract{ - // Name: to.Ptr("59307d350af58404d8a26300"), - // Type: to.Ptr("Microsoft.ApiManagement/service/groups/users"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/59307d350af58404d8a26300"), - // Properties: &armapimanagement.UserContractProperties{ - // Identities: []*armapimanagement.UserIdentityContract{ - // }, - // State: to.Ptr(armapimanagement.UserStateActive), - // Email: to.Ptr("testuser1@live.com"), - // FirstName: to.Ptr("test"), - // Groups: []*armapimanagement.GroupContractProperties{ - // }, - // LastName: to.Ptr("user"), - // RegistrationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-01T20:46:45.437Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGroupUser.json -func ExampleGroupUserClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGroupUserClient().Delete(ctx, "rg1", "apimService1", "templategroup", "59307d350af58404d8a26300", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/identityprovider_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/identityprovider_client.go index 4cdfd29ce200..3dd5a04324a1 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/identityprovider_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/identityprovider_client.go @@ -29,8 +29,7 @@ type IdentityProviderClient struct { } // NewIdentityProviderClient creates a new instance of IdentityProviderClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewIdentityProviderClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IdentityProviderClient, error) { @@ -48,8 +47,8 @@ func NewIdentityProviderClient(subscriptionID string, credential azcore.TokenCre // CreateOrUpdate - Creates or Updates the IdentityProvider configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - identityProviderName - Identity Provider Type identifier. // - parameters - Create parameters. @@ -94,7 +93,7 @@ func (client *IdentityProviderClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -118,8 +117,8 @@ func (client *IdentityProviderClient) createOrUpdateHandleResponse(resp *http.Re // Delete - Deletes the specified identity provider configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - identityProviderName - Identity Provider Type identifier. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -164,7 +163,7 @@ func (client *IdentityProviderClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -174,8 +173,8 @@ func (client *IdentityProviderClient) deleteCreateRequest(ctx context.Context, r // Get - Gets the configuration details of the identity Provider configured in specified service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - identityProviderName - Identity Provider Type identifier. // - options - IdentityProviderClientGetOptions contains the optional parameters for the IdentityProviderClient.Get method. @@ -218,7 +217,7 @@ func (client *IdentityProviderClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -238,8 +237,8 @@ func (client *IdentityProviderClient) getHandleResponse(resp *http.Response) (Id // GetEntityTag - Gets the entity state (Etag) version of the identityProvider specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - identityProviderName - Identity Provider Type identifier. // - options - IdentityProviderClientGetEntityTagOptions contains the optional parameters for the IdentityProviderClient.GetEntityTag @@ -283,7 +282,7 @@ func (client *IdentityProviderClient) getEntityTagCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -301,8 +300,8 @@ func (client *IdentityProviderClient) getEntityTagHandleResponse(resp *http.Resp // NewListByServicePager - Lists a collection of Identity Provider configured in the specified service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - IdentityProviderClientListByServiceOptions contains the optional parameters for the IdentityProviderClient.NewListByServicePager // method. @@ -354,7 +353,7 @@ func (client *IdentityProviderClient) listByServiceCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -372,8 +371,8 @@ func (client *IdentityProviderClient) listByServiceHandleResponse(resp *http.Res // ListSecrets - Gets the client secret details of the Identity Provider. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - identityProviderName - Identity Provider Type identifier. // - options - IdentityProviderClientListSecretsOptions contains the optional parameters for the IdentityProviderClient.ListSecrets @@ -417,7 +416,7 @@ func (client *IdentityProviderClient) listSecretsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -438,8 +437,8 @@ func (client *IdentityProviderClient) listSecretsHandleResponse(resp *http.Respo // Update - Updates an existing IdentityProvider configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - identityProviderName - Identity Provider Type identifier. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -485,7 +484,7 @@ func (client *IdentityProviderClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/identityprovider_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/identityprovider_client_example_test.go deleted file mode 100644 index c6aee165c61e..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/identityprovider_client_example_test.go +++ /dev/null @@ -1,249 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListIdentityProviders.json -func ExampleIdentityProviderClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIdentityProviderClient().NewListByServicePager("rg1", "apimService1", 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.IdentityProviderList = armapimanagement.IdentityProviderList{ - // Count: to.Ptr[int64](3), - // Value: []*armapimanagement.IdentityProviderContract{ - // { - // Name: to.Ptr("Google"), - // Type: to.Ptr("Microsoft.ApiManagement/service/identityProviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/identityProviders/Google"), - // Properties: &armapimanagement.IdentityProviderContractProperties{ - // Type: to.Ptr(armapimanagement.IdentityProviderTypeGoogle), - // ClientID: to.Ptr("googleId"), - // }, - // }, - // { - // Name: to.Ptr("Aad"), - // Type: to.Ptr("Microsoft.ApiManagement/service/identityProviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/identityProviders/Aad"), - // Properties: &armapimanagement.IdentityProviderContractProperties{ - // Type: to.Ptr(armapimanagement.IdentityProviderTypeAAD), - // AllowedTenants: []*string{ - // to.Ptr("samiraad.onmicrosoft.com")}, - // ClientID: to.Ptr("aadapplicationid"), - // }, - // }, - // { - // Name: to.Ptr("AadB2C"), - // Type: to.Ptr("Microsoft.ApiManagement/service/identityProviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/identityProviders/AadB2C"), - // Properties: &armapimanagement.IdentityProviderContractProperties{ - // Type: to.Ptr(armapimanagement.IdentityProviderTypeAADB2C), - // AllowedTenants: []*string{ - // to.Ptr("samirtestbc.onmicrosoft.com")}, - // SigninPolicyName: to.Ptr("B2C_1_Signin_Default"), - // SignupPolicyName: to.Ptr("B2C_1_Signup_Default"), - // ClientID: to.Ptr("aadb2clientId"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadIdentityProvider.json -func ExampleIdentityProviderClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewIdentityProviderClient().GetEntityTag(ctx, "rg1", "apimService1", armapimanagement.IdentityProviderTypeAADB2C, 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetIdentityProvider.json -func ExampleIdentityProviderClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIdentityProviderClient().Get(ctx, "rg1", "apimService1", armapimanagement.IdentityProviderTypeAADB2C, 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.IdentityProviderContract = armapimanagement.IdentityProviderContract{ - // Name: to.Ptr("AadB2C"), - // Type: to.Ptr("Microsoft.ApiManagement/service/identityProviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/identityProviders/AadB2C"), - // Properties: &armapimanagement.IdentityProviderContractProperties{ - // Type: to.Ptr(armapimanagement.IdentityProviderTypeAADB2C), - // AllowedTenants: []*string{ - // to.Ptr("contosoaadb2c.onmicrosoft.com"), - // to.Ptr("contoso2aadb2c.onmicrosoft.com")}, - // Authority: to.Ptr("login.microsoftonline.com"), - // SigninPolicyName: to.Ptr("B2C_1_policy-signin"), - // SigninTenant: to.Ptr("contosoaadb2c.onmicrosoft.com"), - // SignupPolicyName: to.Ptr("B2C_1_policy-signup"), - // ClientID: to.Ptr("f02dafe2-b8b8-48ec-a38e-27e5c16c51e5"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateIdentityProvider.json -func ExampleIdentityProviderClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIdentityProviderClient().CreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.IdentityProviderTypeFacebook, armapimanagement.IdentityProviderCreateContract{ - Properties: &armapimanagement.IdentityProviderCreateContractProperties{ - ClientID: to.Ptr("facebookid"), - ClientSecret: to.Ptr("facebookapplicationsecret"), - }, - }, &armapimanagement.IdentityProviderClientCreateOrUpdateOptions{IfMatch: 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.IdentityProviderContract = armapimanagement.IdentityProviderContract{ - // Name: to.Ptr("Facebook"), - // Type: to.Ptr("Microsoft.ApiManagement/service/identityProviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/identityProviders/Facebook"), - // Properties: &armapimanagement.IdentityProviderContractProperties{ - // Type: to.Ptr(armapimanagement.IdentityProviderTypeFacebook), - // ClientID: to.Ptr("facebookid"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateIdentityProvider.json -func ExampleIdentityProviderClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIdentityProviderClient().Update(ctx, "rg1", "apimService1", armapimanagement.IdentityProviderTypeFacebook, "*", armapimanagement.IdentityProviderUpdateParameters{ - Properties: &armapimanagement.IdentityProviderUpdateProperties{ - ClientID: to.Ptr("updatedfacebookid"), - ClientSecret: to.Ptr("updatedfacebooksecret"), - }, - }, 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.IdentityProviderContract = armapimanagement.IdentityProviderContract{ - // Name: to.Ptr("AadB2C"), - // Type: to.Ptr("Microsoft.ApiManagement/service/identityProviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/identityProviders/AadB2C"), - // Properties: &armapimanagement.IdentityProviderContractProperties{ - // Type: to.Ptr(armapimanagement.IdentityProviderTypeAADB2C), - // AllowedTenants: []*string{ - // to.Ptr("contosoaadb2c.onmicrosoft.com"), - // to.Ptr("contoso2aadb2c.onmicrosoft.com")}, - // Authority: to.Ptr("login.microsoftonline.com"), - // SigninPolicyName: to.Ptr("B2C_1_policy-signin"), - // SigninTenant: to.Ptr("contosoaadb2c.onmicrosoft.com"), - // SignupPolicyName: to.Ptr("B2C_1_policy-signup"), - // ClientID: to.Ptr("f02dafe2-b8b8-48ec-a38e-27e5c16c51e5"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteIdentityProvider.json -func ExampleIdentityProviderClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewIdentityProviderClient().Delete(ctx, "rg1", "apimService1", armapimanagement.IdentityProviderTypeAAD, "*", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementIdentityProviderListSecrets.json -func ExampleIdentityProviderClient_ListSecrets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIdentityProviderClient().ListSecrets(ctx, "rg1", "apimService1", armapimanagement.IdentityProviderTypeAADB2C, 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.ClientSecretContract = armapimanagement.ClientSecretContract{ - // ClientSecret: to.Ptr("XXXXXXX"), - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/issue_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/issue_client.go index 3172e5e7a869..45cf0003b4bf 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/issue_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/issue_client.go @@ -30,8 +30,7 @@ type IssueClient struct { } // NewIssueClient creates a new instance of IssueClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewIssueClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IssueClient, error) { @@ -49,8 +48,8 @@ func NewIssueClient(subscriptionID string, credential azcore.TokenCredential, op // Get - Gets API Management issue details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - issueID - Issue identifier. Must be unique in the current API Management service instance. // - options - IssueClientGetOptions contains the optional parameters for the IssueClient.Get method. @@ -93,7 +92,7 @@ func (client *IssueClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -113,8 +112,8 @@ func (client *IssueClient) getHandleResponse(resp *http.Response) (IssueClientGe // NewListByServicePager - Lists a collection of issues in the specified service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - IssueClientListByServiceOptions contains the optional parameters for the IssueClient.NewListByServicePager method. func (client *IssueClient) NewListByServicePager(resourceGroupName string, serviceName string, options *IssueClientListByServiceOptions) *runtime.Pager[IssueClientListByServiceResponse] { @@ -174,7 +173,7 @@ func (client *IssueClient) listByServiceCreateRequest(ctx context.Context, resou if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/issue_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/issue_client_example_test.go deleted file mode 100644 index 11c8c59f6745..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/issue_client_example_test.go +++ /dev/null @@ -1,96 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListIssues.json -func ExampleIssueClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIssueClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.IssueClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.IssueCollection = armapimanagement.IssueCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.IssueContract{ - // { - // Name: to.Ptr("57d2ef278aa04f0ad01d6cdc"), - // Type: to.Ptr("Microsoft.ApiManagement/service/issues"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/issues/57d2ef278aa04f0ad01d6cdc"), - // Properties: &armapimanagement.IssueContractProperties{ - // APIID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a"), - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-01T22:21:20.467Z"); return t}()), - // State: to.Ptr(armapimanagement.StateOpen), - // Description: to.Ptr("New API issue description"), - // Title: to.Ptr("New API issue"), - // UserID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetIssue.json -func ExampleIssueClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIssueClient().Get(ctx, "rg1", "apimService1", "57d2ef278aa04f0ad01d6cdc", 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.IssueContract = armapimanagement.IssueContract{ - // Name: to.Ptr("57d2ef278aa04f0ad01d6cdc"), - // Type: to.Ptr("Microsoft.ApiManagement/service/issues"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/issues/57d2ef278aa04f0ad01d6cdc"), - // Properties: &armapimanagement.IssueContractProperties{ - // APIID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a"), - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-01T22:21:20.467Z"); return t}()), - // State: to.Ptr(armapimanagement.StateOpen), - // Description: to.Ptr("New API issue description"), - // Title: to.Ptr("New API issue"), - // UserID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - // }, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/logger_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/logger_client.go index 3ad0afd2ffdf..cb21bbb07e0f 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/logger_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/logger_client.go @@ -30,8 +30,7 @@ type LoggerClient struct { } // NewLoggerClient creates a new instance of LoggerClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewLoggerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LoggerClient, error) { @@ -49,8 +48,8 @@ func NewLoggerClient(subscriptionID string, credential azcore.TokenCredential, o // CreateOrUpdate - Creates or Updates a logger. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - loggerID - Logger identifier. Must be unique in the API Management service instance. // - parameters - Create parameters. @@ -94,7 +93,7 @@ func (client *LoggerClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -118,8 +117,8 @@ func (client *LoggerClient) createOrUpdateHandleResponse(resp *http.Response) (L // Delete - Deletes the specified logger. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - loggerID - Logger identifier. Must be unique in the API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -164,7 +163,7 @@ func (client *LoggerClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -174,8 +173,8 @@ func (client *LoggerClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets the details of the logger specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - loggerID - Logger identifier. Must be unique in the API Management service instance. // - options - LoggerClientGetOptions contains the optional parameters for the LoggerClient.Get method. @@ -218,7 +217,7 @@ func (client *LoggerClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -238,8 +237,8 @@ func (client *LoggerClient) getHandleResponse(resp *http.Response) (LoggerClient // GetEntityTag - Gets the entity state (Etag) version of the logger specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - loggerID - Logger identifier. Must be unique in the API Management service instance. // - options - LoggerClientGetEntityTagOptions contains the optional parameters for the LoggerClient.GetEntityTag method. @@ -282,7 +281,7 @@ func (client *LoggerClient) getEntityTagCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -300,8 +299,8 @@ func (client *LoggerClient) getEntityTagHandleResponse(resp *http.Response) (Log // NewListByServicePager - Lists a collection of loggers in the specified service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - LoggerClientListByServiceOptions contains the optional parameters for the LoggerClient.NewListByServicePager // method. @@ -362,7 +361,7 @@ func (client *LoggerClient) listByServiceCreateRequest(ctx context.Context, reso if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -380,8 +379,8 @@ func (client *LoggerClient) listByServiceHandleResponse(resp *http.Response) (Lo // Update - Updates an existing logger. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - loggerID - Logger identifier. Must be unique in the API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -427,7 +426,7 @@ func (client *LoggerClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/logger_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/logger_client_example_test.go deleted file mode 100644 index 317b37e5241e..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/logger_client_example_test.go +++ /dev/null @@ -1,274 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListLoggers.json -func ExampleLoggerClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLoggerClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.LoggerClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.LoggerCollection = armapimanagement.LoggerCollection{ - // Count: to.Ptr[int64](3), - // Value: []*armapimanagement.LoggerContract{ - // { - // Name: to.Ptr("azuremonitor"), - // Type: to.Ptr("Microsoft.ApiManagement/service/loggers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/azuremonitor"), - // Properties: &armapimanagement.LoggerContractProperties{ - // IsBuffered: to.Ptr(true), - // LoggerType: to.Ptr(armapimanagement.LoggerTypeAzureMonitor), - // }, - // }, - // { - // Name: to.Ptr("vvktest"), - // Type: to.Ptr("Microsoft.ApiManagement/service/loggers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/vvktest"), - // Properties: &armapimanagement.LoggerContractProperties{ - // Credentials: map[string]*string{ - // "instrumentationKey": to.Ptr("{{Logger-Credentials-5b1a17ef2b3f91153004b10d}}"), - // }, - // IsBuffered: to.Ptr(true), - // LoggerType: to.Ptr(armapimanagement.LoggerTypeApplicationInsights), - // }, - // }, - // { - // Name: to.Ptr("applicationinsights"), - // Type: to.Ptr("Microsoft.ApiManagement/service/loggers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/applicationinsights"), - // Properties: &armapimanagement.LoggerContractProperties{ - // Description: to.Ptr("miaoappinsight"), - // Credentials: map[string]*string{ - // "instrumentationKey": to.Ptr("{{Logger-Credentials-5b2056062b3f911ae84a3069}}"), - // }, - // IsBuffered: to.Ptr(true), - // LoggerType: to.Ptr(armapimanagement.LoggerTypeApplicationInsights), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadLogger.json -func ExampleLoggerClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewLoggerClient().GetEntityTag(ctx, "rg1", "apimService1", "templateLogger", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetLogger.json -func ExampleLoggerClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoggerClient().Get(ctx, "rg1", "apimService1", "templateLogger", 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.LoggerContract = armapimanagement.LoggerContract{ - // Name: to.Ptr("kloudapilogger1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/loggers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/kloudapilogger1"), - // Properties: &armapimanagement.LoggerContractProperties{ - // Description: to.Ptr("testeventhub3again"), - // Credentials: map[string]*string{ - // "name": to.Ptr("testeventhub4"), - // "connectionString": to.Ptr("Endpoint=sb://eventhubapim.servicebus.windows.net/;SharedAccessKeyName=Sender;SharedAccessKey=************"), - // }, - // IsBuffered: to.Ptr(true), - // LoggerType: to.Ptr(armapimanagement.LoggerTypeAzureEventHub), - // ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.EventHub/namespaces/eventhubapim"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateAILogger.json -func ExampleLoggerClient_CreateOrUpdate_apiManagementCreateAiLogger() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoggerClient().CreateOrUpdate(ctx, "rg1", "apimService1", "loggerId", armapimanagement.LoggerContract{ - Properties: &armapimanagement.LoggerContractProperties{ - Description: to.Ptr("adding a new logger"), - Credentials: map[string]*string{ - "instrumentationKey": to.Ptr("11................a1"), - }, - LoggerType: to.Ptr(armapimanagement.LoggerTypeApplicationInsights), - }, - }, &armapimanagement.LoggerClientCreateOrUpdateOptions{IfMatch: 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.LoggerContract = armapimanagement.LoggerContract{ - // Name: to.Ptr("loggerId"), - // Type: to.Ptr("Microsoft.ApiManagement/service/loggers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/loggerId"), - // Properties: &armapimanagement.LoggerContractProperties{ - // Credentials: map[string]*string{ - // "instrumentationKey": to.Ptr("{{5a.......2a}}"), - // }, - // IsBuffered: to.Ptr(false), - // LoggerType: to.Ptr(armapimanagement.LoggerTypeApplicationInsights), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateEHLogger.json -func ExampleLoggerClient_CreateOrUpdate_apiManagementCreateEhLogger() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoggerClient().CreateOrUpdate(ctx, "rg1", "apimService1", "eh1", armapimanagement.LoggerContract{ - Properties: &armapimanagement.LoggerContractProperties{ - Description: to.Ptr("adding a new logger"), - Credentials: map[string]*string{ - "name": to.Ptr("hydraeventhub"), - "connectionString": to.Ptr("Endpoint=sb://hydraeventhub-ns.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=********="), - }, - LoggerType: to.Ptr(armapimanagement.LoggerTypeAzureEventHub), - }, - }, &armapimanagement.LoggerClientCreateOrUpdateOptions{IfMatch: 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.LoggerContract = armapimanagement.LoggerContract{ - // Name: to.Ptr("eh1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/loggers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/eh1"), - // Properties: &armapimanagement.LoggerContractProperties{ - // Description: to.Ptr("adding a new logger"), - // Credentials: map[string]*string{ - // "connectionString": to.Ptr("{{Logger-Credentials-5f28745bbebeeb13cc3f7301}}"), - // }, - // IsBuffered: to.Ptr(true), - // LoggerType: to.Ptr(armapimanagement.LoggerTypeAzureEventHub), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateLogger.json -func ExampleLoggerClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoggerClient().Update(ctx, "rg1", "apimService1", "eh1", "*", armapimanagement.LoggerUpdateContract{ - Properties: &armapimanagement.LoggerUpdateParameters{ - Description: to.Ptr("updating description"), - LoggerType: to.Ptr(armapimanagement.LoggerTypeAzureEventHub), - }, - }, 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.LoggerContract = armapimanagement.LoggerContract{ - // Name: to.Ptr("eh1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/loggers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/eh1"), - // Properties: &armapimanagement.LoggerContractProperties{ - // Description: to.Ptr("updating description"), - // Credentials: map[string]*string{ - // "connectionString": to.Ptr("{{Logger-Credentials-5f28745bbebeeb13cc3f7301}}"), - // }, - // IsBuffered: to.Ptr(true), - // LoggerType: to.Ptr(armapimanagement.LoggerTypeAzureEventHub), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteLogger.json -func ExampleLoggerClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewLoggerClient().Delete(ctx, "rg1", "apimService1", "loggerId", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/models.go b/sdk/resourcemanager/apimanagement/armapimanagement/models.go index 492def6fc900..04354cfb082c 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/models.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/models.go @@ -296,7 +296,7 @@ type APICreateOrUpdateProperties struct { // API name. Must be 1 to 300 characters long. DisplayName *string - // Format of the Content in which the API is getting imported. + // Format of the Content in which the API is getting imported. New formats can be added in the future Format *ContentFormat // Indicates if API revision is current api revision. @@ -315,7 +315,7 @@ type APICreateOrUpdateProperties struct { // * http creates a REST API // * soap creates a SOAP pass-through API // * websocket creates websocket API - // * graphql creates GraphQL API. + // * graphql creates GraphQL API. New types can be added in the future. SoapAPIType *SoapAPIType // API identifier of the source API. @@ -330,6 +330,10 @@ type APICreateOrUpdateProperties struct { // A URL to the Terms of Service for the API. MUST be in the format of a URL. TermsOfServiceURL *string + // Strategy of translating required query parameters to template ones. By default has value 'template'. Possible values: 'template', + // 'query' + TranslateRequiredQueryParametersConduct *TranslateRequiredQueryParametersConduct + // Content value when Importing an API. Value *string @@ -1138,6 +1142,44 @@ type APIVersionSetUpdateParametersProperties struct { VersioningScheme *VersioningScheme } +// APIWikiClientCreateOrUpdateOptions contains the optional parameters for the APIWikiClient.CreateOrUpdate method. +type APIWikiClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// APIWikiClientDeleteOptions contains the optional parameters for the APIWikiClient.Delete method. +type APIWikiClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// APIWikiClientGetEntityTagOptions contains the optional parameters for the APIWikiClient.GetEntityTag method. +type APIWikiClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// APIWikiClientGetOptions contains the optional parameters for the APIWikiClient.Get method. +type APIWikiClientGetOptions struct { + // placeholder for future optional parameters +} + +// APIWikiClientUpdateOptions contains the optional parameters for the APIWikiClient.Update method. +type APIWikiClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// APIWikisClientListOptions contains the optional parameters for the APIWikisClient.NewListPager method. +type APIWikisClientListOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | eq | contains | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + // AccessInformationCollection - Paged AccessInformation list representation. type AccessInformationCollection struct { // Total record count number across all pages. @@ -1242,6 +1284,9 @@ type AdditionalLocation struct { // in this additional location. DisableGateway *bool + // Property can be used to enable NAT Gateway for this API Management service. + NatGatewayState *NatGatewayState + // Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the location. Supported // only for Premium SKU being deployed in Virtual Network. PublicIPAddressID *string @@ -1255,6 +1300,10 @@ type AdditionalLocation struct { // READ-ONLY; Gateway URL of the API Management service in the Region. GatewayRegionalURL *string + // READ-ONLY; Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium + // SKU on stv2 platform. + OutboundPublicIPAddresses []*string + // READ-ONLY; Compute Platform Version running the service. PlatformVersion *PlatformVersion @@ -1315,8 +1364,281 @@ type AuthenticationSettingsContract struct { // OAuth2 Authentication settings OAuth2 *OAuth2AuthenticationSettingsContract + // Collection of OAuth2 authentication settings included into this API. + OAuth2AuthenticationSettings []*OAuth2AuthenticationSettingsContract + // OpenID Connect Authentication Settings Openid *OpenIDAuthenticationSettingsContract + + // Collection of Open ID Connect authentication settings included into this API. + OpenidAuthenticationSettings []*OpenIDAuthenticationSettingsContract +} + +// AuthorizationAccessPolicyClientCreateOrUpdateOptions contains the optional parameters for the AuthorizationAccessPolicyClient.CreateOrUpdate +// method. +type AuthorizationAccessPolicyClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// AuthorizationAccessPolicyClientDeleteOptions contains the optional parameters for the AuthorizationAccessPolicyClient.Delete +// method. +type AuthorizationAccessPolicyClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AuthorizationAccessPolicyClientGetOptions contains the optional parameters for the AuthorizationAccessPolicyClient.Get +// method. +type AuthorizationAccessPolicyClientGetOptions struct { + // placeholder for future optional parameters +} + +// AuthorizationAccessPolicyClientListByAuthorizationOptions contains the optional parameters for the AuthorizationAccessPolicyClient.NewListByAuthorizationPager +// method. +type AuthorizationAccessPolicyClientListByAuthorizationOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// AuthorizationAccessPolicyCollection - Paged Authorization Access Policy list representation. +type AuthorizationAccessPolicyCollection struct { + // Total record count number across all pages. + Count *int64 + + // Next page link if any. + NextLink *string + + // Page values. + Value []*AuthorizationAccessPolicyContract +} + +// AuthorizationAccessPolicyContract - Authorization access policy contract. +type AuthorizationAccessPolicyContract struct { + // Properties of the Authorization Contract. + Properties *AuthorizationAccessPolicyContractProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// AuthorizationAccessPolicyContractProperties - Authorization Access Policy details. +type AuthorizationAccessPolicyContractProperties struct { + // The Object Id + ObjectID *string + + // The Tenant Id + TenantID *string +} + +// AuthorizationClientConfirmConsentCodeOptions contains the optional parameters for the AuthorizationClient.ConfirmConsentCode +// method. +type AuthorizationClientConfirmConsentCodeOptions struct { + // placeholder for future optional parameters +} + +// AuthorizationClientCreateOrUpdateOptions contains the optional parameters for the AuthorizationClient.CreateOrUpdate method. +type AuthorizationClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// AuthorizationClientDeleteOptions contains the optional parameters for the AuthorizationClient.Delete method. +type AuthorizationClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AuthorizationClientGetOptions contains the optional parameters for the AuthorizationClient.Get method. +type AuthorizationClientGetOptions struct { + // placeholder for future optional parameters +} + +// AuthorizationClientListByAuthorizationProviderOptions contains the optional parameters for the AuthorizationClient.NewListByAuthorizationProviderPager +// method. +type AuthorizationClientListByAuthorizationProviderOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// AuthorizationCollection - Paged Authorization list representation. +type AuthorizationCollection struct { + // Total record count number across all pages. + Count *int64 + + // Next page link if any. + NextLink *string + + // Page values. + Value []*AuthorizationContract +} + +// AuthorizationConfirmConsentCodeRequestContract - Authorization confirm consent code request contract. +type AuthorizationConfirmConsentCodeRequestContract struct { + // The consent code from the authorization server after authorizing and consenting. + ConsentCode *string +} + +// AuthorizationContract - Authorization contract. +type AuthorizationContract struct { + // Properties of the Authorization Contract. + Properties *AuthorizationContractProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// AuthorizationContractProperties - Authorization details. +type AuthorizationContractProperties struct { + // Authorization type options + AuthorizationType *AuthorizationType + + // Authorization error details. + Error *AuthorizationError + + // OAuth2 grant type options + OAuth2GrantType *OAuth2GrantType + + // Authorization parameters + Parameters map[string]*string + + // Status of the Authorization + Status *string +} + +// AuthorizationError - Authorization error details. +type AuthorizationError struct { + // Error code + Code *string + + // Error message + Message *string +} + +// AuthorizationLoginLinksClientPostOptions contains the optional parameters for the AuthorizationLoginLinksClient.Post method. +type AuthorizationLoginLinksClientPostOptions struct { + // placeholder for future optional parameters +} + +// AuthorizationLoginRequestContract - Authorization login request contract. +type AuthorizationLoginRequestContract struct { + // The redirect URL after login has completed. + PostLoginRedirectURL *string +} + +// AuthorizationLoginResponseContract - Authorization login response contract. +type AuthorizationLoginResponseContract struct { + // The login link + LoginLink *string +} + +// AuthorizationProviderClientCreateOrUpdateOptions contains the optional parameters for the AuthorizationProviderClient.CreateOrUpdate +// method. +type AuthorizationProviderClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// AuthorizationProviderClientDeleteOptions contains the optional parameters for the AuthorizationProviderClient.Delete method. +type AuthorizationProviderClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AuthorizationProviderClientGetOptions contains the optional parameters for the AuthorizationProviderClient.Get method. +type AuthorizationProviderClientGetOptions struct { + // placeholder for future optional parameters +} + +// AuthorizationProviderClientListByServiceOptions contains the optional parameters for the AuthorizationProviderClient.NewListByServicePager +// method. +type AuthorizationProviderClientListByServiceOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// AuthorizationProviderCollection - Paged Authorization Provider list representation. +type AuthorizationProviderCollection struct { + // Next page link if any. + NextLink *string + + // Page values. + Value []*AuthorizationProviderContract +} + +// AuthorizationProviderContract - Authorization Provider contract. +type AuthorizationProviderContract struct { + // Properties of the Authorization Provider Contract. + Properties *AuthorizationProviderContractProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// AuthorizationProviderContractProperties - Authorization Provider details. +type AuthorizationProviderContractProperties struct { + // Authorization Provider name. Must be 1 to 300 characters long. + DisplayName *string + + // Identity provider name. Must be 1 to 300 characters long. + IdentityProvider *string + + // OAuth2 settings + Oauth2 *AuthorizationProviderOAuth2Settings +} + +// AuthorizationProviderOAuth2GrantTypes - Authorization Provider oauth2 grant types settings +type AuthorizationProviderOAuth2GrantTypes struct { + // OAuth2 authorization code grant parameters + AuthorizationCode map[string]*string + + // OAuth2 client credential grant parameters + ClientCredentials map[string]*string +} + +// AuthorizationProviderOAuth2Settings - OAuth2 settings details +type AuthorizationProviderOAuth2Settings struct { + // OAuth2 settings + GrantTypes *AuthorizationProviderOAuth2GrantTypes + + // Redirect URL to be set in the OAuth application. + RedirectURL *string } // AuthorizationServerClientCreateOrUpdateOptions contains the optional parameters for the AuthorizationServerClient.CreateOrUpdate @@ -1494,6 +1816,13 @@ type AuthorizationServerContractProperties struct { // OAuth token endpoint. Contains absolute URI to entity being referenced. TokenEndpoint *string + + // If true, the authorization server will be used in the API documentation in the developer portal. False by default if no + // value is provided. + UseInAPIDocumentation *bool + + // If true, the authorization server may be used in the developer portal test console. True by default if no value is provided. + UseInTestConsole *bool } // AuthorizationServerSecretsContract - OAuth Server Secrets Contract. @@ -1584,6 +1913,13 @@ type AuthorizationServerUpdateContractProperties struct { // OAuth token endpoint. Contains absolute URI to entity being referenced. TokenEndpoint *string + + // If true, the authorization server will be used in the API documentation in the developer portal. False by default if no + // value is provided. + UseInAPIDocumentation *bool + + // If true, the authorization server may be used in the developer portal test console. True by default if no value is provided. + UseInTestConsole *bool } // BackendAuthorizationHeaderCredentials - Authorization header information. @@ -1597,6 +1933,9 @@ type BackendAuthorizationHeaderCredentials struct { // BackendBaseParameters - Backend entity base Parameter set. type BackendBaseParameters struct { + // Backend Circuit Breaker Configuration + CircuitBreaker *BackendCircuitBreaker + // Backend Credentials Contract Properties Credentials *BackendCredentialsContract @@ -1606,10 +1945,10 @@ type BackendBaseParameters struct { // Backend Properties contract Properties *BackendProperties - // Backend Proxy Contract Properties + // Backend gateway Contract Properties Proxy *BackendProxyContract - // Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or + // Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or // API Apps. ResourceID *string @@ -1620,6 +1959,12 @@ type BackendBaseParameters struct { Title *string } +// BackendCircuitBreaker - The configuration of the backend circuit breaker +type BackendCircuitBreaker struct { + // The rules for tripping the backend. + Rules []*CircuitBreakerRule +} + // BackendClientCreateOrUpdateOptions contains the optional parameters for the BackendClient.CreateOrUpdate method. type BackendClientCreateOrUpdateOptions struct { // ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -1701,6 +2046,9 @@ type BackendContractProperties struct { // REQUIRED; Runtime Url of the Backend. URL *string + // Backend Circuit Breaker Configuration + CircuitBreaker *BackendCircuitBreaker + // Backend Credentials Contract Properties Credentials *BackendCredentialsContract @@ -1710,10 +2058,10 @@ type BackendContractProperties struct { // Backend Properties contract Properties *BackendProperties - // Backend Proxy Contract Properties + // Backend gateway Contract Properties Proxy *BackendProxyContract - // Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or + // Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or // API Apps. ResourceID *string @@ -1816,6 +2164,9 @@ type BackendTLSProperties struct { // BackendUpdateParameterProperties - Parameters supplied to the Update Backend operation. type BackendUpdateParameterProperties struct { + // Backend Circuit Breaker Configuration + CircuitBreaker *BackendCircuitBreaker + // Backend Credentials Contract Properties Credentials *BackendCredentialsContract @@ -1828,10 +2179,10 @@ type BackendUpdateParameterProperties struct { // Backend communication protocol. Protocol *BackendProtocol - // Backend Proxy Contract Properties + // Backend gateway Contract Properties Proxy *BackendProxyContract - // Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or + // Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or // API Apps. ResourceID *string @@ -2088,6 +2439,36 @@ type CertificateInformation struct { Thumbprint *string } +// CircuitBreakerFailureCondition - The trip conditions of the circuit breaker +type CircuitBreakerFailureCondition struct { + // The threshold for opening the circuit. + Count *int64 + + // The error reasons which are considered as failure. + ErrorReasons []*string + + // The interval during which the failures are counted. + Interval *string + + // The threshold for opening the circuit. + Percentage *int64 + + // The status code ranges which are considered as failure. + StatusCodeRanges []*FailureStatusCodeRange +} + +// CircuitBreakerRule - Rule configuration to trip the backend. +type CircuitBreakerRule struct { + // The conditions for tripping the circuit breaker. + FailureCondition *CircuitBreakerFailureCondition + + // The rule name. + Name *string + + // The duration for which the circuit will be tripped. + TripDuration *string +} + // ClientBeginPerformConnectivityCheckAsyncOptions contains the optional parameters for the Client.BeginPerformConnectivityCheckAsync // method. type ClientBeginPerformConnectivityCheckAsyncOptions struct { @@ -2101,6 +2482,14 @@ type ClientSecretContract struct { ClientSecret *string } +// ConfigurationAPI - Information regarding the Configuration API of the API Management service. +type ConfigurationAPI struct { + // Indication whether or not the legacy Configuration API (v1) should be exposed on the API Management service. Value is optional + // but must be 'Enabled' or 'Disabled'. If 'Disabled', legacy Configuration + // API (v1) will not be available for self-hosted gateways. Default value is 'Enabled' + LegacyAPI *LegacyAPIState +} + // ConnectivityCheckRequest - A request to perform the connectivity check operation on a API Management service. type ConnectivityCheckRequest struct { // REQUIRED; The connectivity check operation destination. @@ -2562,6 +2951,9 @@ type DiagnosticContractProperties struct { // Log the ClientIP. Default is false. LogClientIP *bool + // Emit custom metrics via emit-metric policy. Applicable only to Application Insights diagnostic settings. + Metrics *bool + // The format of the Operation Name for Application Insights telemetries. Default is Name. OperationNameFormat *OperationNameFormat @@ -2572,33 +2964,33 @@ type DiagnosticContractProperties struct { Verbosity *Verbosity } -// EmailTemplateClientCreateOrUpdateOptions contains the optional parameters for the EmailTemplateClient.CreateOrUpdate method. -type EmailTemplateClientCreateOrUpdateOptions struct { +// DocumentationClientCreateOrUpdateOptions contains the optional parameters for the DocumentationClient.CreateOrUpdate method. +type DocumentationClientCreateOrUpdateOptions struct { // ETag of the Entity. Not required when creating an entity, but required when updating an entity. IfMatch *string } -// EmailTemplateClientDeleteOptions contains the optional parameters for the EmailTemplateClient.Delete method. -type EmailTemplateClientDeleteOptions struct { +// DocumentationClientDeleteOptions contains the optional parameters for the DocumentationClient.Delete method. +type DocumentationClientDeleteOptions struct { // placeholder for future optional parameters } -// EmailTemplateClientGetEntityTagOptions contains the optional parameters for the EmailTemplateClient.GetEntityTag method. -type EmailTemplateClientGetEntityTagOptions struct { +// DocumentationClientGetEntityTagOptions contains the optional parameters for the DocumentationClient.GetEntityTag method. +type DocumentationClientGetEntityTagOptions struct { // placeholder for future optional parameters } -// EmailTemplateClientGetOptions contains the optional parameters for the EmailTemplateClient.Get method. -type EmailTemplateClientGetOptions struct { +// DocumentationClientGetOptions contains the optional parameters for the DocumentationClient.Get method. +type DocumentationClientGetOptions struct { // placeholder for future optional parameters } -// EmailTemplateClientListByServiceOptions contains the optional parameters for the EmailTemplateClient.NewListByServicePager +// DocumentationClientListByServiceOptions contains the optional parameters for the DocumentationClient.NewListByServicePager // method. -type EmailTemplateClientListByServiceOptions struct { +type DocumentationClientListByServiceOptions struct { // | Field | Usage | Supported operators | Supported functions | // |-------------|-------------|-------------|-------------| - // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | name | filter | eq | contains | Filter *string // Number of records to skip. Skip *int32 @@ -2606,27 +2998,24 @@ type EmailTemplateClientListByServiceOptions struct { Top *int32 } -// EmailTemplateClientUpdateOptions contains the optional parameters for the EmailTemplateClient.Update method. -type EmailTemplateClientUpdateOptions struct { +// DocumentationClientUpdateOptions contains the optional parameters for the DocumentationClient.Update method. +type DocumentationClientUpdateOptions struct { // placeholder for future optional parameters } -// EmailTemplateCollection - Paged email template list representation. -type EmailTemplateCollection struct { - // Total record count number across all pages. - Count *int64 - - // Next page link if any. +// DocumentationCollection - Paged Documentation list representation. +type DocumentationCollection struct { + // READ-ONLY; Next page link if any. NextLink *string - // Page values. - Value []*EmailTemplateContract + // READ-ONLY; Page values. + Value []*DocumentationContract } -// EmailTemplateContract - Email Template details. -type EmailTemplateContract struct { - // Email Template entity contract properties. - Properties *EmailTemplateContractProperties +// DocumentationContract - Markdown documentation details. +type DocumentationContract struct { + // Markdown Documentation details. + Properties *DocumentationContractProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string @@ -2638,13 +3027,94 @@ type EmailTemplateContract struct { Type *string } -// EmailTemplateContractProperties - Email Template Contract properties. -type EmailTemplateContractProperties struct { - // REQUIRED; Email Template Body. This should be a valid XDocument - Body *string - - // REQUIRED; Subject of the Template. - Subject *string +// DocumentationContractProperties - Markdown documentation details. +type DocumentationContractProperties struct { + // Markdown documentation content. + Content *string + + // documentation title. + Title *string +} + +// DocumentationUpdateContract - Documentation update contract details. +type DocumentationUpdateContract struct { + // Markdown Documentation details. + Properties *DocumentationContractProperties +} + +// EmailTemplateClientCreateOrUpdateOptions contains the optional parameters for the EmailTemplateClient.CreateOrUpdate method. +type EmailTemplateClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// EmailTemplateClientDeleteOptions contains the optional parameters for the EmailTemplateClient.Delete method. +type EmailTemplateClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// EmailTemplateClientGetEntityTagOptions contains the optional parameters for the EmailTemplateClient.GetEntityTag method. +type EmailTemplateClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// EmailTemplateClientGetOptions contains the optional parameters for the EmailTemplateClient.Get method. +type EmailTemplateClientGetOptions struct { + // placeholder for future optional parameters +} + +// EmailTemplateClientListByServiceOptions contains the optional parameters for the EmailTemplateClient.NewListByServicePager +// method. +type EmailTemplateClientListByServiceOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// EmailTemplateClientUpdateOptions contains the optional parameters for the EmailTemplateClient.Update method. +type EmailTemplateClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// EmailTemplateCollection - Paged email template list representation. +type EmailTemplateCollection struct { + // Total record count number across all pages. + Count *int64 + + // Next page link if any. + NextLink *string + + // Page values. + Value []*EmailTemplateContract +} + +// EmailTemplateContract - Email Template details. +type EmailTemplateContract struct { + // Email Template entity contract properties. + Properties *EmailTemplateContractProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// EmailTemplateContractProperties - Email Template Contract properties. +type EmailTemplateContractProperties struct { + // REQUIRED; Email Template Body. This should be a valid XDocument + Body *string + + // REQUIRED; Subject of the Template. + Subject *string // Description of the Email Template. Description *string @@ -2743,6 +3213,15 @@ type ErrorResponseBody struct { Message *string } +// FailureStatusCodeRange - The failure http status code range +type FailureStatusCodeRange struct { + // The maximum http status code. + Max *int32 + + // The minimum http status code. + Min *int32 +} + // GatewayAPIClientCreateOrUpdateOptions contains the optional parameters for the GatewayAPIClient.CreateOrUpdate method. type GatewayAPIClientCreateOrUpdateOptions struct { Parameters *AssociationContract @@ -2864,6 +3343,12 @@ type GatewayClientGetOptions struct { // placeholder for future optional parameters } +// GatewayClientInvalidateDebugCredentialsOptions contains the optional parameters for the GatewayClient.InvalidateDebugCredentials +// method. +type GatewayClientInvalidateDebugCredentialsOptions struct { + // placeholder for future optional parameters +} + // GatewayClientListByServiceOptions contains the optional parameters for the GatewayClient.NewListByServicePager method. type GatewayClientListByServiceOptions struct { // | Field | Usage | Supported operators | Supported functions | @@ -2878,11 +3363,21 @@ type GatewayClientListByServiceOptions struct { Top *int32 } +// GatewayClientListDebugCredentialsOptions contains the optional parameters for the GatewayClient.ListDebugCredentials method. +type GatewayClientListDebugCredentialsOptions struct { + // placeholder for future optional parameters +} + // GatewayClientListKeysOptions contains the optional parameters for the GatewayClient.ListKeys method. type GatewayClientListKeysOptions struct { // placeholder for future optional parameters } +// GatewayClientListTraceOptions contains the optional parameters for the GatewayClient.ListTrace method. +type GatewayClientListTraceOptions struct { + // placeholder for future optional parameters +} + // GatewayClientRegenerateKeyOptions contains the optional parameters for the GatewayClient.RegenerateKey method. type GatewayClientRegenerateKeyOptions struct { // placeholder for future optional parameters @@ -2929,6 +3424,12 @@ type GatewayContractProperties struct { LocationData *ResourceLocationDataContract } +// GatewayDebugCredentialsContract - Gateway debug credentials. +type GatewayDebugCredentialsContract struct { + // Gateway debug token. + Token *string +} + // GatewayHostnameConfigurationClientCreateOrUpdateOptions contains the optional parameters for the GatewayHostnameConfigurationClient.CreateOrUpdate // method. type GatewayHostnameConfigurationClientCreateOrUpdateOptions struct { @@ -3028,6 +3529,25 @@ type GatewayKeysContract struct { Secondary *string } +// GatewayListDebugCredentialsContract - List debug credentials properties. +type GatewayListDebugCredentialsContract struct { + // REQUIRED; Full resource Id of an API. + APIID *string + + // REQUIRED; Purposes of debug credential. + Purposes []*GatewayListDebugCredentialsContractPurpose + + // Credentials expiration in ISO8601 format. Maximum duration of the credentials is PT1H. When property is not specified, + // them value PT1H is used. + CredentialsExpireAfter *string +} + +// GatewayListTraceContract - List trace properties. +type GatewayListTraceContract struct { + // Trace id. + TraceID *string +} + // GatewayTokenContract - Gateway access token. type GatewayTokenContract struct { // Shared Access Authentication token value for the Gateway. @@ -3129,6 +3649,81 @@ type GlobalSchemaContractProperties struct { Value any } +// GraphQLAPIResolverClientCreateOrUpdateOptions contains the optional parameters for the GraphQLAPIResolverClient.CreateOrUpdate +// method. +type GraphQLAPIResolverClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// GraphQLAPIResolverClientDeleteOptions contains the optional parameters for the GraphQLAPIResolverClient.Delete method. +type GraphQLAPIResolverClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// GraphQLAPIResolverClientGetEntityTagOptions contains the optional parameters for the GraphQLAPIResolverClient.GetEntityTag +// method. +type GraphQLAPIResolverClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// GraphQLAPIResolverClientGetOptions contains the optional parameters for the GraphQLAPIResolverClient.Get method. +type GraphQLAPIResolverClientGetOptions struct { + // placeholder for future optional parameters +} + +// GraphQLAPIResolverClientListByAPIOptions contains the optional parameters for the GraphQLAPIResolverClient.NewListByAPIPager +// method. +type GraphQLAPIResolverClientListByAPIOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// GraphQLAPIResolverClientUpdateOptions contains the optional parameters for the GraphQLAPIResolverClient.Update method. +type GraphQLAPIResolverClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// GraphQLAPIResolverPolicyClientCreateOrUpdateOptions contains the optional parameters for the GraphQLAPIResolverPolicyClient.CreateOrUpdate +// method. +type GraphQLAPIResolverPolicyClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// GraphQLAPIResolverPolicyClientDeleteOptions contains the optional parameters for the GraphQLAPIResolverPolicyClient.Delete +// method. +type GraphQLAPIResolverPolicyClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// GraphQLAPIResolverPolicyClientGetEntityTagOptions contains the optional parameters for the GraphQLAPIResolverPolicyClient.GetEntityTag +// method. +type GraphQLAPIResolverPolicyClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// GraphQLAPIResolverPolicyClientGetOptions contains the optional parameters for the GraphQLAPIResolverPolicyClient.Get method. +type GraphQLAPIResolverPolicyClientGetOptions struct { + // Policy Export Format. + Format *PolicyExportFormat +} + +// GraphQLAPIResolverPolicyClientListByResolverOptions contains the optional parameters for the GraphQLAPIResolverPolicyClient.NewListByResolverPager +// method. +type GraphQLAPIResolverPolicyClientListByResolverOptions struct { + // placeholder for future optional parameters +} + // GroupClientCreateOrUpdateOptions contains the optional parameters for the GroupClient.CreateOrUpdate method. type GroupClientCreateOrUpdateOptions struct { // ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -3339,7 +3934,7 @@ type HostnameConfiguration struct { // Specify true to setup the certificate associated with this Hostname as the Default SSL Certificate. If a client does not // send the SNI header, then this will be the certificate that will be challenged. // The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. - // The setting only applied to Proxy Hostname Type. + // The setting only applied to gateway Hostname Type. DefaultSSLBinding *bool // Base64 Encoded certificate. @@ -3366,6 +3961,9 @@ type IdentityProviderBaseParameters struct { // OpenID Connect discovery endpoint hostname for AAD or AAD B2C. Authority *string + // The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. + ClientLibrary *string + // Password Reset Policy Name. Only applies to AAD B2C Identity Provider. PasswordResetPolicyName *string @@ -3452,6 +4050,9 @@ type IdentityProviderContractProperties struct { // OpenID Connect discovery endpoint hostname for AAD or AAD B2C. Authority *string + // The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. + ClientLibrary *string + // Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is // App Secret for Facebook login, API Key for Google login, Public Key for // Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. @@ -3509,6 +4110,9 @@ type IdentityProviderCreateContractProperties struct { // OpenID Connect discovery endpoint hostname for AAD or AAD B2C. Authority *string + // The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. + ClientLibrary *string + // Password Reset Policy Name. Only applies to AAD B2C Identity Provider. PasswordResetPolicyName *string @@ -3558,6 +4162,9 @@ type IdentityProviderUpdateProperties struct { // App ID for Microsoft. ClientID *string + // The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. + ClientLibrary *string + // Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is // App Secret for Facebook login, API Key for Google login, Public Key for // Microsoft. @@ -3915,6 +4522,12 @@ type LoggerUpdateParameters struct { LoggerType *LoggerType } +// MigrateToStv2Contract - Describes an available API Management SKU. +type MigrateToStv2Contract struct { + // Mode of Migration to stv2. Default is PreserveIp. + Mode *MigrateToStv2Mode +} + // NamedValueClientBeginCreateOrUpdateOptions contains the optional parameters for the NamedValueClient.BeginCreateOrUpdate // method. type NamedValueClientBeginCreateOrUpdateOptions struct { @@ -4337,6 +4950,14 @@ type OpenidConnectProviderContractProperties struct { // User-friendly description of OpenID Connect Provider. Description *string + + // If true, the Open ID Connect provider will be used in the API documentation in the developer portal. False by default if + // no value is provided. + UseInAPIDocumentation *bool + + // If true, the Open ID Connect provider may be used in the developer portal test console. True by default if no value is + // provided. + UseInTestConsole *bool } // OpenidConnectProviderUpdateContract - Parameters supplied to the Update OpenID Connect Provider operation. @@ -4361,6 +4982,14 @@ type OpenidConnectProviderUpdateContractProperties struct { // Metadata endpoint URI. MetadataEndpoint *string + + // If true, the Open ID Connect provider will be used in the API documentation in the developer portal. False by default if + // no value is provided. + UseInAPIDocumentation *bool + + // If true, the Open ID Connect provider may be used in the developer portal test console. True by default if no value is + // provided. + UseInTestConsole *bool } // Operation - REST API operation @@ -4715,7 +5344,7 @@ type PolicyClientGetOptions struct { Format *PolicyExportFormat } -// PolicyClientListByServiceOptions contains the optional parameters for the PolicyClient.ListByService method. +// PolicyClientListByServiceOptions contains the optional parameters for the PolicyClient.NewListByServicePager method. type PolicyClientListByServiceOptions struct { // placeholder for future optional parameters } @@ -4763,12 +5392,12 @@ type PolicyDescriptionClientListByServiceOptions struct { Scope *PolicyScopeContract } -// PolicyDescriptionCollection - Descriptions of APIM policies. +// PolicyDescriptionCollection - Descriptions of API Management policies. type PolicyDescriptionCollection struct { // Total record count number. Count *int64 - // Descriptions of APIM policies. + // Descriptions of API Management policies. Value []*PolicyDescriptionContract } @@ -4796,85 +5425,73 @@ type PolicyDescriptionContractProperties struct { Scope *int64 } -// PortalDelegationSettings - Delegation settings for a developer portal. -type PortalDelegationSettings struct { - // Delegation settings contract properties. - Properties *PortalDelegationSettingsProperties - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// PortalDelegationSettingsProperties - Delegation settings contract properties. -type PortalDelegationSettingsProperties struct { - // Subscriptions delegation settings. - Subscriptions *SubscriptionsDelegationSettingsProperties - - // A delegation Url. - URL *string - - // User registration delegation settings. - UserRegistration *RegistrationDelegationSettingsProperties - - // A base64-encoded validation key to validate, that a request is coming from Azure API Management. - ValidationKey *string -} - -// PortalRevisionClientBeginCreateOrUpdateOptions contains the optional parameters for the PortalRevisionClient.BeginCreateOrUpdate +// PolicyFragmentClientBeginCreateOrUpdateOptions contains the optional parameters for the PolicyFragmentClient.BeginCreateOrUpdate // method. -type PortalRevisionClientBeginCreateOrUpdateOptions struct { +type PolicyFragmentClientBeginCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string // Resumes the LRO from the provided token. ResumeToken string } -// PortalRevisionClientBeginUpdateOptions contains the optional parameters for the PortalRevisionClient.BeginUpdate method. -type PortalRevisionClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// PolicyFragmentClientDeleteOptions contains the optional parameters for the PolicyFragmentClient.Delete method. +type PolicyFragmentClientDeleteOptions struct { + // placeholder for future optional parameters } -// PortalRevisionClientGetEntityTagOptions contains the optional parameters for the PortalRevisionClient.GetEntityTag method. -type PortalRevisionClientGetEntityTagOptions struct { +// PolicyFragmentClientGetEntityTagOptions contains the optional parameters for the PolicyFragmentClient.GetEntityTag method. +type PolicyFragmentClientGetEntityTagOptions struct { // placeholder for future optional parameters } -// PortalRevisionClientGetOptions contains the optional parameters for the PortalRevisionClient.Get method. -type PortalRevisionClientGetOptions struct { - // placeholder for future optional parameters +// PolicyFragmentClientGetOptions contains the optional parameters for the PolicyFragmentClient.Get method. +type PolicyFragmentClientGetOptions struct { + // Policy fragment content format. + Format *PolicyFragmentContentFormat } -// PortalRevisionClientListByServiceOptions contains the optional parameters for the PortalRevisionClient.NewListByServicePager +// PolicyFragmentClientListByServiceOptions contains the optional parameters for the PolicyFragmentClient.NewListByServicePager // method. -type PortalRevisionClientListByServiceOptions struct { - // FIELD SUPPORTED OPERATORS SUPPORTED FUNCTIONS - // |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| |description | ge, le, eq, ne, gt, lt | substringof, - // contains, startswith, endswith| |isCurrent | eq, ne | | +type PolicyFragmentClientListByServiceOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | Filter *string + // OData order by query option. + Orderby *string // Number of records to skip. Skip *int32 // Number of records to return. Top *int32 } -// PortalRevisionCollection - Paged list of portal revisions. -type PortalRevisionCollection struct { - // READ-ONLY; Next page link, if any. +// PolicyFragmentClientListReferencesOptions contains the optional parameters for the PolicyFragmentClient.ListReferences +// method. +type PolicyFragmentClientListReferencesOptions struct { + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// PolicyFragmentCollection - The response of the get policy fragments operation. +type PolicyFragmentCollection struct { + // Total record count number. + Count *int64 + + // Next page link if any. NextLink *string - // READ-ONLY; Collection of portal revisions. - Value []*PortalRevisionContract + // Policy fragment contract value. + Value []*PolicyFragmentContract } -// PortalRevisionContract - Portal Revision's contract details. -type PortalRevisionContract struct { - // Properties of the portal revisions. - Properties *PortalRevisionContractProperties +// PolicyFragmentContract - Policy fragment contract details. +type PolicyFragmentContract struct { + // Properties of the Policy Fragment. + Properties *PolicyFragmentContractProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string @@ -4886,21 +5503,241 @@ type PortalRevisionContract struct { Type *string } -type PortalRevisionContractProperties struct { - // Portal revision description. - Description *string +// PolicyFragmentContractProperties - Policy fragment contract properties. +type PolicyFragmentContractProperties struct { + // REQUIRED; Contents of the policy fragment. + Value *string - // Indicates if the portal's revision is public. - IsCurrent *bool + // Policy fragment description. + Description *string - // READ-ONLY; Portal's revision creation date and time. - CreatedDateTime *time.Time + // Format of the policy fragment content. + Format *PolicyFragmentContentFormat +} - // READ-ONLY; Status of the portal's revision. - Status *PortalRevisionStatus +// PortalConfigClientCreateOrUpdateOptions contains the optional parameters for the PortalConfigClient.CreateOrUpdate method. +type PortalConfigClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} - // READ-ONLY; Portal revision publishing status details. - StatusDetails *string +// PortalConfigClientGetEntityTagOptions contains the optional parameters for the PortalConfigClient.GetEntityTag method. +type PortalConfigClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// PortalConfigClientGetOptions contains the optional parameters for the PortalConfigClient.Get method. +type PortalConfigClientGetOptions struct { + // placeholder for future optional parameters +} + +// PortalConfigClientListByServiceOptions contains the optional parameters for the PortalConfigClient.NewListByServicePager +// method. +type PortalConfigClientListByServiceOptions struct { + // placeholder for future optional parameters +} + +// PortalConfigClientUpdateOptions contains the optional parameters for the PortalConfigClient.Update method. +type PortalConfigClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// PortalConfigCollection - The collection of the developer portal configurations. +type PortalConfigCollection struct { + // The developer portal configurations. + Value []*PortalConfigContract + + // READ-ONLY; Next page link if any. + NextLink *string +} + +// PortalConfigContract - The developer portal configuration contract. +type PortalConfigContract struct { + // The developer portal configuration contract properties. + Properties *PortalConfigProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PortalConfigCorsProperties - The developer portal Cross-Origin Resource Sharing (CORS) settings. +type PortalConfigCorsProperties struct { + // Allowed origins, e.g. https://trusted.com. + AllowedOrigins []*string +} + +// PortalConfigCspProperties - The developer portal Content Security Policy (CSP) settings. +type PortalConfigCspProperties struct { + // Allowed sources, e.g. *.trusted.com, trusted.com, https://. + AllowedSources []*string + + // The mode of the developer portal Content Security Policy (CSP). + Mode *PortalSettingsCspMode + + // The URLs used by the browser to report CSP violations. + ReportURI []*string +} + +type PortalConfigDelegationProperties struct { + // Enable or disable delegation for user registration. + DelegateRegistration *bool + + // Enable or disable delegation for product subscriptions. + DelegateSubscription *bool + + // A delegation endpoint URL. + DelegationURL *string + + // A base64-encoded validation key to ensure requests originate from Azure API Management service. + ValidationKey *string +} + +// PortalConfigProperties - The developer portal configuration contract properties. +type PortalConfigProperties struct { + // The developer portal Cross-Origin Resource Sharing (CORS) settings. + Cors *PortalConfigCorsProperties + + // The developer portal Content Security Policy (CSP) settings. + Csp *PortalConfigCspProperties + + // The developer portal delegation settings. + Delegation *PortalConfigDelegationProperties + + // Enable or disable Basic authentication method. + EnableBasicAuth *bool + Signin *PortalConfigPropertiesSignin + Signup *PortalConfigPropertiesSignup +} + +type PortalConfigPropertiesSignin struct { + // Redirect anonymous users to the sign-in page. + Require *bool +} + +type PortalConfigPropertiesSignup struct { + // Terms of service settings. + TermsOfService *PortalConfigTermsOfServiceProperties +} + +// PortalConfigTermsOfServiceProperties - Terms of service contract properties. +type PortalConfigTermsOfServiceProperties struct { + // Ask user for consent to the terms of service. + RequireConsent *bool + + // A terms of service text. + Text *string +} + +// PortalDelegationSettings - Delegation settings for a developer portal. +type PortalDelegationSettings struct { + // Delegation settings contract properties. + Properties *PortalDelegationSettingsProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PortalDelegationSettingsProperties - Delegation settings contract properties. +type PortalDelegationSettingsProperties struct { + // Subscriptions delegation settings. + Subscriptions *SubscriptionsDelegationSettingsProperties + + // A delegation Url. + URL *string + + // User registration delegation settings. + UserRegistration *RegistrationDelegationSettingsProperties + + // A base64-encoded validation key to validate, that a request is coming from Azure API Management. + ValidationKey *string +} + +// PortalRevisionClientBeginCreateOrUpdateOptions contains the optional parameters for the PortalRevisionClient.BeginCreateOrUpdate +// method. +type PortalRevisionClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PortalRevisionClientBeginUpdateOptions contains the optional parameters for the PortalRevisionClient.BeginUpdate method. +type PortalRevisionClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PortalRevisionClientGetEntityTagOptions contains the optional parameters for the PortalRevisionClient.GetEntityTag method. +type PortalRevisionClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// PortalRevisionClientGetOptions contains the optional parameters for the PortalRevisionClient.Get method. +type PortalRevisionClientGetOptions struct { + // placeholder for future optional parameters +} + +// PortalRevisionClientListByServiceOptions contains the optional parameters for the PortalRevisionClient.NewListByServicePager +// method. +type PortalRevisionClientListByServiceOptions struct { + // FIELD SUPPORTED OPERATORS SUPPORTED FUNCTIONS + // |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| |description | ge, le, eq, ne, gt, lt | substringof, + // contains, startswith, endswith| |isCurrent | eq, ne | | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// PortalRevisionCollection - Paged list of portal revisions. +type PortalRevisionCollection struct { + // READ-ONLY; Next page link, if any. + NextLink *string + + // READ-ONLY; Collection of portal revisions. + Value []*PortalRevisionContract +} + +// PortalRevisionContract - Portal Revision's contract details. +type PortalRevisionContract struct { + // Properties of the portal revisions. + Properties *PortalRevisionContractProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +type PortalRevisionContractProperties struct { + // Portal revision description. + Description *string + + // Indicates if the portal's revision is public. + IsCurrent *bool + + // READ-ONLY; Portal's revision creation date and time. + CreatedDateTime *time.Time + + // READ-ONLY; Status of the portal's revision. + Status *PortalRevisionStatus + + // READ-ONLY; Portal revision publishing status details. + StatusDetails *string // READ-ONLY; Last updated date and time. UpdatedDateTime *time.Time @@ -4917,12 +5754,12 @@ type PortalSettingsClientListByServiceOptions struct { // placeholder for future optional parameters } -// PortalSettingsCollection - Descriptions of APIM policies. +// PortalSettingsCollection - Descriptions of API Management policies. type PortalSettingsCollection struct { // Total record count number. Count *int64 - // Descriptions of APIM policies. + // Descriptions of API Management policies. Value []*PortalSettingsContract } @@ -5191,6 +6028,68 @@ type ProductAPIClientListByProductOptions struct { Top *int32 } +// ProductAPILinkClientCreateOrUpdateOptions contains the optional parameters for the ProductAPILinkClient.CreateOrUpdate +// method. +type ProductAPILinkClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ProductAPILinkClientDeleteOptions contains the optional parameters for the ProductAPILinkClient.Delete method. +type ProductAPILinkClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ProductAPILinkClientGetOptions contains the optional parameters for the ProductAPILinkClient.Get method. +type ProductAPILinkClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProductAPILinkClientListByProductOptions contains the optional parameters for the ProductAPILinkClient.NewListByProductPager +// method. +type ProductAPILinkClientListByProductOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// ProductAPILinkCollection - Paged Product-API link list representation. +type ProductAPILinkCollection struct { + // Total record count number across all pages. + Count *int64 + + // Next page link if any. + NextLink *string + + // Page values. + Value []*ProductAPILinkContract +} + +// ProductAPILinkContract - Product-API link details. +type ProductAPILinkContract struct { + // Product-API link entity contract properties. + Properties *ProductAPILinkContractProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ProductAPILinkContractProperties - Product-API link entity properties. +type ProductAPILinkContractProperties struct { + // REQUIRED; Full resource Id of an API. + APIID *string +} + // ProductClientCreateOrUpdateOptions contains the optional parameters for the ProductClient.CreateOrUpdate method. type ProductClientCreateOrUpdateOptions struct { // ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -5384,6 +6283,68 @@ type ProductGroupClientListByProductOptions struct { Top *int32 } +// ProductGroupLinkClientCreateOrUpdateOptions contains the optional parameters for the ProductGroupLinkClient.CreateOrUpdate +// method. +type ProductGroupLinkClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ProductGroupLinkClientDeleteOptions contains the optional parameters for the ProductGroupLinkClient.Delete method. +type ProductGroupLinkClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ProductGroupLinkClientGetOptions contains the optional parameters for the ProductGroupLinkClient.Get method. +type ProductGroupLinkClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProductGroupLinkClientListByProductOptions contains the optional parameters for the ProductGroupLinkClient.NewListByProductPager +// method. +type ProductGroupLinkClientListByProductOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// ProductGroupLinkCollection - Paged Product-group link list representation. +type ProductGroupLinkCollection struct { + // Total record count number across all pages. + Count *int64 + + // Next page link if any. + NextLink *string + + // Page values. + Value []*ProductGroupLinkContract +} + +// ProductGroupLinkContract - Product-group link details. +type ProductGroupLinkContract struct { + // Product-group link entity contract properties. + Properties *ProductGroupLinkContractProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ProductGroupLinkContractProperties - Product-group link entity properties. +type ProductGroupLinkContractProperties struct { + // REQUIRED; Full resource Id of a group. + GroupID *string +} + // ProductPolicyClientCreateOrUpdateOptions contains the optional parameters for the ProductPolicyClient.CreateOrUpdate method. type ProductPolicyClientCreateOrUpdateOptions struct { // ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -5406,7 +6367,8 @@ type ProductPolicyClientGetOptions struct { Format *PolicyExportFormat } -// ProductPolicyClientListByProductOptions contains the optional parameters for the ProductPolicyClient.ListByProduct method. +// ProductPolicyClientListByProductOptions contains the optional parameters for the ProductPolicyClient.NewListByProductPager +// method. type ProductPolicyClientListByProductOptions struct { // placeholder for future optional parameters } @@ -5513,14 +6475,65 @@ type ProductUpdateProperties struct { Terms *string } -// QuotaByCounterKeysClientListByServiceOptions contains the optional parameters for the QuotaByCounterKeysClient.ListByService -// method. -type QuotaByCounterKeysClientListByServiceOptions struct { - // placeholder for future optional parameters +// ProductWikiClientCreateOrUpdateOptions contains the optional parameters for the ProductWikiClient.CreateOrUpdate method. +type ProductWikiClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string } -// QuotaByCounterKeysClientUpdateOptions contains the optional parameters for the QuotaByCounterKeysClient.Update method. -type QuotaByCounterKeysClientUpdateOptions struct { +// ProductWikiClientDeleteOptions contains the optional parameters for the ProductWikiClient.Delete method. +type ProductWikiClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ProductWikiClientGetEntityTagOptions contains the optional parameters for the ProductWikiClient.GetEntityTag method. +type ProductWikiClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// ProductWikiClientGetOptions contains the optional parameters for the ProductWikiClient.Get method. +type ProductWikiClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProductWikiClientUpdateOptions contains the optional parameters for the ProductWikiClient.Update method. +type ProductWikiClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ProductWikisClientListOptions contains the optional parameters for the ProductWikisClient.NewListPager method. +type ProductWikisClientListOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | eq | contains | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a +// location +type ProxyResource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// QuotaByCounterKeysClientListByServiceOptions contains the optional parameters for the QuotaByCounterKeysClient.ListByService +// method. +type QuotaByCounterKeysClientListByServiceOptions struct { + // placeholder for future optional parameters +} + +// QuotaByCounterKeysClientUpdateOptions contains the optional parameters for the QuotaByCounterKeysClient.Update method. +type QuotaByCounterKeysClientUpdateOptions struct { // placeholder for future optional parameters } @@ -5754,7 +6767,7 @@ type ReportRecordContract struct { // and HttpStatusCode.TooManyRequests CallCountBlocked *int32 - // Number of calls failed due to proxy or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and + // Number of calls failed due to gateway or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and // any Code between HttpStatusCode.InternalServerError (500) and 600 CallCountFailed *int32 @@ -5988,6 +7001,118 @@ type RequestReportRecordContract struct { UserID *string } +// ResolverCollection - Paged Resolver list representation. +type ResolverCollection struct { + // Total record count number across all pages. + Count *int64 + + // READ-ONLY; Next page link if any. + NextLink *string + + // READ-ONLY; Page values. + Value []*ResolverContract +} + +// ResolverContract - GraphQL API Resolver details. +type ResolverContract struct { + // Properties of the Resolver Contract. + Properties *ResolverEntityBaseContract + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ResolverEntityBaseContract - GraphQL API Resolver Entity Base Contract details. +type ResolverEntityBaseContract struct { + // Description of the resolver. May include HTML formatting tags. + Description *string + + // Resolver Name. + DisplayName *string + + // Path is type/field being resolved. + Path *string +} + +// ResolverResultContract - Long Running Git Resolver Results. +type ResolverResultContract struct { + // Properties of the Resolver Contract. + Properties *ResolverResultContractProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ResolverResultContractProperties - Resolver Result. +type ResolverResultContractProperties struct { + // Error Body Contract + Error *ErrorResponseBody + + // Resolver result identifier. + ID *string + + // Optional result info. + ResultInfo *string + + // Start time of an async resolver. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO + // 8601 standard. + Started *time.Time + + // Status of an async resolver. + Status *AsyncResolverStatus + + // Last update time of an async resolver. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by + // the ISO 8601 standard. + Updated *time.Time + + // READ-ONLY; This property if only provided as part of the TenantConfigurationValidate resolver. It contains the log the + // entities which will be updated/created/deleted as part of the TenantConfigurationDeploy + // resolver. + ActionLog []*ResolverResultLogItemContract +} + +// ResolverResultLogItemContract - Log of the entity being created, updated or deleted. +type ResolverResultLogItemContract struct { + // Action like create/update/delete. + Action *string + + // Identifier of the entity being created/updated/deleted. + ObjectKey *string + + // The type of entity contract. + ObjectType *string +} + +// ResolverUpdateContract - GraphQL API Resolver Update Contract details. +type ResolverUpdateContract struct { + // Properties of the GraphQL API Resolver entity that can be updated. + Properties *ResolverUpdateContractProperties +} + +// ResolverUpdateContractProperties - Resolver Update Contract Properties. +type ResolverUpdateContractProperties struct { + // Description of the resolver. May include HTML formatting tags. + Description *string + + // Resolver Name. + DisplayName *string + + // Path is type/field being resolved. + Path *string +} + // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} @@ -6000,6 +7125,29 @@ type Resource struct { Type *string } +// ResourceCollection - A collection of resources. +type ResourceCollection struct { + // Total record count number. + Count *int64 + + // Next page link if any. + NextLink *string + + // A collection of resources. + Value []*ResourceCollectionValueItem +} + +type ResourceCollectionValueItem struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + // ResourceLocationDataContract - Resource location data properties. type ResourceLocationDataContract struct { // REQUIRED; A canonical name for the geographic or physical location. @@ -6271,10 +7419,11 @@ type SchemaContractProperties struct { // - Swagger Schema use application/vnd.ms-azure-apim.swagger.definitions+json // - WSDL Schema use application/vnd.ms-azure-apim.xsd+xml // - OpenApi Schema use application/vnd.oai.openapi.components+json - // - WADL Schema use application/vnd.ms-azure-apim.wadl.grammars+xml. + // - WADL Schema use application/vnd.ms-azure-apim.wadl.grammars+xml + // - OData Schema use application/vnd.ms-azure-apim.odata.schema. ContentType *string - // Create or update Properties of the API Schema Document. + // REQUIRED; Create or update Properties of the API Schema Document. Document *SchemaDocumentProperties } @@ -6330,6 +7479,9 @@ type ServiceBaseProperties struct { // is 10. Certificates []*CertificateConfiguration + // Configuration API configuration of the API Management service. + ConfigurationAPI *ConfigurationAPI + // Custom properties of the API Management service. // Setting Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168 will disable the cipher TLSRSAWITH3DESEDECBCSHA // for all TLS(1.0, 1.1 and 1.2). @@ -6344,17 +7496,20 @@ type ServiceBaseProperties struct { // API Management service. // Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For // all the settings except Http2 the default value is True if the service was - // created on or before April 1st 2018 and False otherwise. Http2 setting's default value is False. - // You can disable any of next ciphers by using settings Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]: - // TLSECDHEECDSAWITHAES256CBCSHA, TLSECDHEECDSAWITHAES128CBCSHA, TLS - // ECDHERSAWITHAES256CBCSHA, TLSECDHERSAWITHAES128CBCSHA, TLSRSAWITHAES128GCMSHA256, TLSRSAWITHAES256CBCSHA256, TLSRSAWITHAES128CBCSHA256, - // TLSRSAWITHAES256CBCSHA, TLSRSAWITHAES128CBCSHA. For example, - // Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256:false. The default value - // is true for them. Note: next ciphers can't be disabled since they are required by - // Azure CloudService internal components: TLSECDHEECDSAWITHAES256GCMSHA384,TLSECDHEECDSAWITHAES128GCMSHA256,TLSECDHERSAWITHAES256GCMSHA384,TLSECDHERSAWITHAES128GCMSHA256,TLSECDHEECDSAWITHAES256CBC - // SHA384,TLSECDHEECDSAWITHAES128CBCSHA256,TLSECDHERSAWITHAES256CBCSHA384,TLSECDHERSAWITHAES128CBCSHA256,TLSRSAWITHAES256GCMSHA384 + // created on or before April 1, 2018 and False otherwise. Http2 setting's default value is False. + // You can disable any of the following ciphers by using settings Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]: + // TLSECDHEECDSAWITHAES256CBCSHA, TLSECDHEECDSAWITHAES128CBC + // SHA, TLSECDHERSAWITHAES256CBCSHA, TLSECDHERSAWITHAES128CBCSHA, TLSRSAWITHAES128GCMSHA256, TLSRSAWITHAES256CBCSHA256, TLSRSAWITHAES128CBCSHA256, + // TLSRSAWITHAES256CBCSHA, TLSRSAWITHAES128CBCSHA. For + // example, Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256:false. The default + // value is true for them. + // Note: The following ciphers can't be disabled since they are required by internal platform components: TLSAES256GCMSHA384,TLSAES128GCMSHA256,TLSECDHEECDSAWITHAES256GCMSHA384,TLSECDHEECDSAWITHAES128GCM + // SHA256,TLSECDHERSAWITHAES256GCMSHA384,TLSECDHERSAWITHAES128GCMSHA256,TLSECDHEECDSAWITHAES256CBCSHA384,TLSECDHEECDSAWITHAES128CBCSHA256,TLSECDHERSAWITHAES256CBCSHA384,TLSECDHERSAWITHAES128CBCSHA256 CustomProperties map[string]*string + // Enable developer portal for this API Management service. + DeveloperPortalEnabled *bool + // Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway // in master region. DisableGateway *bool @@ -6367,6 +7522,12 @@ type ServiceBaseProperties struct { // Custom hostname configuration of the API Management service. HostnameConfigurations []*HostnameConfiguration + // Enable legacy portal for this API Management service. + LegacyPortalEnabled *bool + + // Property can be used to enable NAT Gateway for this API Management service. + NatGatewayState *NatGatewayState + // Email address from which the notification will be sent. NotificationSenderEmail *string @@ -6412,6 +7573,10 @@ type ServiceBaseProperties struct { // READ-ONLY; Management API endpoint URL of the API Management service. ManagementAPIURL *string + // READ-ONLY; Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium + // SKU on stv2 platform. + OutboundPublicIPAddresses []*string + // READ-ONLY; Compute Platform Version running the service in this location. PlatformVersion *PlatformVersion @@ -6473,6 +7638,14 @@ type ServiceClientBeginDeleteOptions struct { ResumeToken string } +// ServiceClientBeginMigrateToStv2Options contains the optional parameters for the ServiceClient.BeginMigrateToStv2 method. +type ServiceClientBeginMigrateToStv2Options struct { + // Optional parameters supplied to migrate service. + Parameters *MigrateToStv2Contract + // Resumes the LRO from the provided token. + ResumeToken string +} + // ServiceClientBeginRestoreOptions contains the optional parameters for the ServiceClient.BeginRestore method. type ServiceClientBeginRestoreOptions struct { // Resumes the LRO from the provided token. @@ -6592,6 +7765,9 @@ type ServiceProperties struct { // is 10. Certificates []*CertificateConfiguration + // Configuration API configuration of the API Management service. + ConfigurationAPI *ConfigurationAPI + // Custom properties of the API Management service. // Setting Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168 will disable the cipher TLSRSAWITH3DESEDECBCSHA // for all TLS(1.0, 1.1 and 1.2). @@ -6606,17 +7782,20 @@ type ServiceProperties struct { // API Management service. // Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For // all the settings except Http2 the default value is True if the service was - // created on or before April 1st 2018 and False otherwise. Http2 setting's default value is False. - // You can disable any of next ciphers by using settings Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]: - // TLSECDHEECDSAWITHAES256CBCSHA, TLSECDHEECDSAWITHAES128CBCSHA, TLS - // ECDHERSAWITHAES256CBCSHA, TLSECDHERSAWITHAES128CBCSHA, TLSRSAWITHAES128GCMSHA256, TLSRSAWITHAES256CBCSHA256, TLSRSAWITHAES128CBCSHA256, - // TLSRSAWITHAES256CBCSHA, TLSRSAWITHAES128CBCSHA. For example, - // Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256:false. The default value - // is true for them. Note: next ciphers can't be disabled since they are required by - // Azure CloudService internal components: TLSECDHEECDSAWITHAES256GCMSHA384,TLSECDHEECDSAWITHAES128GCMSHA256,TLSECDHERSAWITHAES256GCMSHA384,TLSECDHERSAWITHAES128GCMSHA256,TLSECDHEECDSAWITHAES256CBC - // SHA384,TLSECDHEECDSAWITHAES128CBCSHA256,TLSECDHERSAWITHAES256CBCSHA384,TLSECDHERSAWITHAES128CBCSHA256,TLSRSAWITHAES256GCMSHA384 + // created on or before April 1, 2018 and False otherwise. Http2 setting's default value is False. + // You can disable any of the following ciphers by using settings Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]: + // TLSECDHEECDSAWITHAES256CBCSHA, TLSECDHEECDSAWITHAES128CBC + // SHA, TLSECDHERSAWITHAES256CBCSHA, TLSECDHERSAWITHAES128CBCSHA, TLSRSAWITHAES128GCMSHA256, TLSRSAWITHAES256CBCSHA256, TLSRSAWITHAES128CBCSHA256, + // TLSRSAWITHAES256CBCSHA, TLSRSAWITHAES128CBCSHA. For + // example, Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256:false. The default + // value is true for them. + // Note: The following ciphers can't be disabled since they are required by internal platform components: TLSAES256GCMSHA384,TLSAES128GCMSHA256,TLSECDHEECDSAWITHAES256GCMSHA384,TLSECDHEECDSAWITHAES128GCM + // SHA256,TLSECDHERSAWITHAES256GCMSHA384,TLSECDHERSAWITHAES128GCMSHA256,TLSECDHEECDSAWITHAES256CBCSHA384,TLSECDHEECDSAWITHAES128CBCSHA256,TLSECDHERSAWITHAES256CBCSHA384,TLSECDHERSAWITHAES128CBCSHA256 CustomProperties map[string]*string + // Enable developer portal for this API Management service. + DeveloperPortalEnabled *bool + // Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway // in master region. DisableGateway *bool @@ -6629,6 +7808,12 @@ type ServiceProperties struct { // Custom hostname configuration of the API Management service. HostnameConfigurations []*HostnameConfiguration + // Enable legacy portal for this API Management service. + LegacyPortalEnabled *bool + + // Property can be used to enable NAT Gateway for this API Management service. + NatGatewayState *NatGatewayState + // Email address from which the notification will be sent. NotificationSenderEmail *string @@ -6674,6 +7859,10 @@ type ServiceProperties struct { // READ-ONLY; Management API endpoint URL of the API Management service. ManagementAPIURL *string + // READ-ONLY; Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium + // SKU on stv2 platform. + OutboundPublicIPAddresses []*string + // READ-ONLY; Compute Platform Version running the service in this location. PlatformVersion *PlatformVersion @@ -6794,6 +7983,9 @@ type ServiceUpdateProperties struct { // is 10. Certificates []*CertificateConfiguration + // Configuration API configuration of the API Management service. + ConfigurationAPI *ConfigurationAPI + // Custom properties of the API Management service. // Setting Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168 will disable the cipher TLSRSAWITH3DESEDECBCSHA // for all TLS(1.0, 1.1 and 1.2). @@ -6808,17 +8000,20 @@ type ServiceUpdateProperties struct { // API Management service. // Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For // all the settings except Http2 the default value is True if the service was - // created on or before April 1st 2018 and False otherwise. Http2 setting's default value is False. - // You can disable any of next ciphers by using settings Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]: - // TLSECDHEECDSAWITHAES256CBCSHA, TLSECDHEECDSAWITHAES128CBCSHA, TLS - // ECDHERSAWITHAES256CBCSHA, TLSECDHERSAWITHAES128CBCSHA, TLSRSAWITHAES128GCMSHA256, TLSRSAWITHAES256CBCSHA256, TLSRSAWITHAES128CBCSHA256, - // TLSRSAWITHAES256CBCSHA, TLSRSAWITHAES128CBCSHA. For example, - // Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256:false. The default value - // is true for them. Note: next ciphers can't be disabled since they are required by - // Azure CloudService internal components: TLSECDHEECDSAWITHAES256GCMSHA384,TLSECDHEECDSAWITHAES128GCMSHA256,TLSECDHERSAWITHAES256GCMSHA384,TLSECDHERSAWITHAES128GCMSHA256,TLSECDHEECDSAWITHAES256CBC - // SHA384,TLSECDHEECDSAWITHAES128CBCSHA256,TLSECDHERSAWITHAES256CBCSHA384,TLSECDHERSAWITHAES128CBCSHA256,TLSRSAWITHAES256GCMSHA384 + // created on or before April 1, 2018 and False otherwise. Http2 setting's default value is False. + // You can disable any of the following ciphers by using settings Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]: + // TLSECDHEECDSAWITHAES256CBCSHA, TLSECDHEECDSAWITHAES128CBC + // SHA, TLSECDHERSAWITHAES256CBCSHA, TLSECDHERSAWITHAES128CBCSHA, TLSRSAWITHAES128GCMSHA256, TLSRSAWITHAES256CBCSHA256, TLSRSAWITHAES128CBCSHA256, + // TLSRSAWITHAES256CBCSHA, TLSRSAWITHAES128CBCSHA. For + // example, Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256:false. The default + // value is true for them. + // Note: The following ciphers can't be disabled since they are required by internal platform components: TLSAES256GCMSHA384,TLSAES128GCMSHA256,TLSECDHEECDSAWITHAES256GCMSHA384,TLSECDHEECDSAWITHAES128GCM + // SHA256,TLSECDHERSAWITHAES256GCMSHA384,TLSECDHERSAWITHAES128GCMSHA256,TLSECDHEECDSAWITHAES256CBCSHA384,TLSECDHEECDSAWITHAES128CBCSHA256,TLSECDHERSAWITHAES256CBCSHA384,TLSECDHERSAWITHAES128CBCSHA256 CustomProperties map[string]*string + // Enable developer portal for this API Management service. + DeveloperPortalEnabled *bool + // Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway // in master region. DisableGateway *bool @@ -6831,6 +8026,12 @@ type ServiceUpdateProperties struct { // Custom hostname configuration of the API Management service. HostnameConfigurations []*HostnameConfiguration + // Enable legacy portal for this API Management service. + LegacyPortalEnabled *bool + + // Property can be used to enable NAT Gateway for this API Management service. + NatGatewayState *NatGatewayState + // Email address from which the notification will be sent. NotificationSenderEmail *string @@ -6882,6 +8083,10 @@ type ServiceUpdateProperties struct { // READ-ONLY; Management API endpoint URL of the API Management service. ManagementAPIURL *string + // READ-ONLY; Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium + // SKU on stv2 platform. + OutboundPublicIPAddresses []*string + // READ-ONLY; Compute Platform Version running the service in this location. PlatformVersion *PlatformVersion @@ -7235,6 +8440,66 @@ type SystemData struct { LastModifiedByType *CreatedByType } +// TagAPILinkClientCreateOrUpdateOptions contains the optional parameters for the TagAPILinkClient.CreateOrUpdate method. +type TagAPILinkClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// TagAPILinkClientDeleteOptions contains the optional parameters for the TagAPILinkClient.Delete method. +type TagAPILinkClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// TagAPILinkClientGetOptions contains the optional parameters for the TagAPILinkClient.Get method. +type TagAPILinkClientGetOptions struct { + // placeholder for future optional parameters +} + +// TagAPILinkClientListByProductOptions contains the optional parameters for the TagAPILinkClient.NewListByProductPager method. +type TagAPILinkClientListByProductOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// TagAPILinkCollection - Paged Tag-API link list representation. +type TagAPILinkCollection struct { + // Total record count number across all pages. + Count *int64 + + // Next page link if any. + NextLink *string + + // Page values. + Value []*TagAPILinkContract +} + +// TagAPILinkContract - Tag-API link details. +type TagAPILinkContract struct { + // Tag-API link entity contract properties. + Properties *TagAPILinkContractProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// TagAPILinkContractProperties - Tag-API link entity properties. +type TagAPILinkContractProperties struct { + // REQUIRED; Full resource Id of an API. + APIID *string +} + // TagClientAssignToAPIOptions contains the optional parameters for the TagClient.AssignToAPI method. type TagClientAssignToAPIOptions struct { // placeholder for future optional parameters @@ -7478,24 +8743,28 @@ type TagDescriptionCreateParameters struct { Properties *TagDescriptionBaseProperties } -// TagResourceClientListByServiceOptions contains the optional parameters for the TagResourceClient.NewListByServicePager +// TagOperationLinkClientCreateOrUpdateOptions contains the optional parameters for the TagOperationLinkClient.CreateOrUpdate // method. -type TagResourceClientListByServiceOptions struct { +type TagOperationLinkClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// TagOperationLinkClientDeleteOptions contains the optional parameters for the TagOperationLinkClient.Delete method. +type TagOperationLinkClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// TagOperationLinkClientGetOptions contains the optional parameters for the TagOperationLinkClient.Get method. +type TagOperationLinkClientGetOptions struct { + // placeholder for future optional parameters +} + +// TagOperationLinkClientListByProductOptions contains the optional parameters for the TagOperationLinkClient.NewListByProductPager +// method. +type TagOperationLinkClientListByProductOptions struct { // | Field | Usage | Supported operators | Supported functions | // |-------------|-------------|-------------|-------------| - // | aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | - // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | - // | displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | - // | apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | - // | apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | - // | path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | - // | description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | - // | serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | - // | method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | - // | urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | - // | terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | - // | state | filter | eq | | - // | isCurrent | filter | eq | | + // | operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | Filter *string // Number of records to skip. Skip *int32 @@ -7503,8 +8772,8 @@ type TagResourceClientListByServiceOptions struct { Top *int32 } -// TagResourceCollection - Paged Tag list representation. -type TagResourceCollection struct { +// TagOperationLinkCollection - Paged Tag-operation link list representation. +type TagOperationLinkCollection struct { // Total record count number across all pages. Count *int64 @@ -7512,53 +8781,173 @@ type TagResourceCollection struct { NextLink *string // Page values. - Value []*TagResourceContract + Value []*TagOperationLinkContract } -// TagResourceContract - TagResource contract properties. -type TagResourceContract struct { - // REQUIRED; Tag associated with the resource. - Tag *TagResourceContractProperties +// TagOperationLinkContract - Tag-operation link details. +type TagOperationLinkContract struct { + // Tag-API link entity contract properties. + Properties *TagOperationLinkContractProperties - // API associated with the tag. - API *APITagResourceContractProperties + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // Operation associated with the tag. - Operation *OperationTagResourceContractProperties + // READ-ONLY; The name of the resource + Name *string - // Product associated with the tag. - Product *ProductTagResourceContractProperties + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// TagResourceContractProperties - Contract defining the Tag property in the Tag Resource Contract -type TagResourceContractProperties struct { - // Tag identifier - ID *string - - // Tag Name - Name *string +// TagOperationLinkContractProperties - Tag-operation link entity properties. +type TagOperationLinkContractProperties struct { + // REQUIRED; Full resource Id of an API operation. + OperationID *string } -// TenantAccessClientCreateOptions contains the optional parameters for the TenantAccessClient.Create method. -type TenantAccessClientCreateOptions struct { +// TagProductLinkClientCreateOrUpdateOptions contains the optional parameters for the TagProductLinkClient.CreateOrUpdate +// method. +type TagProductLinkClientCreateOrUpdateOptions struct { // placeholder for future optional parameters } -// TenantAccessClientGetEntityTagOptions contains the optional parameters for the TenantAccessClient.GetEntityTag method. -type TenantAccessClientGetEntityTagOptions struct { +// TagProductLinkClientDeleteOptions contains the optional parameters for the TagProductLinkClient.Delete method. +type TagProductLinkClientDeleteOptions struct { // placeholder for future optional parameters } -// TenantAccessClientGetOptions contains the optional parameters for the TenantAccessClient.Get method. -type TenantAccessClientGetOptions struct { +// TagProductLinkClientGetOptions contains the optional parameters for the TagProductLinkClient.Get method. +type TagProductLinkClientGetOptions struct { // placeholder for future optional parameters } -// TenantAccessClientListByServiceOptions contains the optional parameters for the TenantAccessClient.NewListByServicePager +// TagProductLinkClientListByProductOptions contains the optional parameters for the TagProductLinkClient.NewListByProductPager // method. -type TenantAccessClientListByServiceOptions struct { - // Not used - Filter *string +type TagProductLinkClientListByProductOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// TagProductLinkCollection - Paged Tag-product link list representation. +type TagProductLinkCollection struct { + // Total record count number across all pages. + Count *int64 + + // Next page link if any. + NextLink *string + + // Page values. + Value []*TagProductLinkContract +} + +// TagProductLinkContract - Tag-product link details. +type TagProductLinkContract struct { + // Tag-API link entity contract properties. + Properties *TagProductLinkContractProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// TagProductLinkContractProperties - Tag-product link entity properties. +type TagProductLinkContractProperties struct { + // REQUIRED; Full resource Id of a product. + ProductID *string +} + +// TagResourceClientListByServiceOptions contains the optional parameters for the TagResourceClient.NewListByServicePager +// method. +type TagResourceClientListByServiceOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | state | filter | eq | | + // | isCurrent | filter | eq | | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// TagResourceCollection - Paged Tag list representation. +type TagResourceCollection struct { + // Total record count number across all pages. + Count *int64 + + // Next page link if any. + NextLink *string + + // Page values. + Value []*TagResourceContract +} + +// TagResourceContract - TagResource contract properties. +type TagResourceContract struct { + // REQUIRED; Tag associated with the resource. + Tag *TagResourceContractProperties + + // API associated with the tag. + API *APITagResourceContractProperties + + // Operation associated with the tag. + Operation *OperationTagResourceContractProperties + + // Product associated with the tag. + Product *ProductTagResourceContractProperties +} + +// TagResourceContractProperties - Contract defining the Tag property in the Tag Resource Contract +type TagResourceContractProperties struct { + // Tag identifier + ID *string + + // Tag Name + Name *string +} + +// TenantAccessClientCreateOptions contains the optional parameters for the TenantAccessClient.Create method. +type TenantAccessClientCreateOptions struct { + // placeholder for future optional parameters +} + +// TenantAccessClientGetEntityTagOptions contains the optional parameters for the TenantAccessClient.GetEntityTag method. +type TenantAccessClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// TenantAccessClientGetOptions contains the optional parameters for the TenantAccessClient.Get method. +type TenantAccessClientGetOptions struct { + // placeholder for future optional parameters +} + +// TenantAccessClientListByServiceOptions contains the optional parameters for the TenantAccessClient.NewListByServicePager +// method. +type TenantAccessClientListByServiceOptions struct { + // Not used + Filter *string } // TenantAccessClientListSecretsOptions contains the optional parameters for the TenantAccessClient.ListSecrets method. @@ -8042,6 +9431,1103 @@ type VirtualNetworkConfiguration struct { Vnetid *string } +// WikiCollection - Paged Wiki list representation. +type WikiCollection struct { + // READ-ONLY; Next page link if any. + NextLink *string + + // READ-ONLY; Page values. + Value []*WikiContract +} + +// WikiContract - Wiki properties +type WikiContract struct { + // Wiki details. + Properties *WikiContractProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// WikiContractProperties - Wiki contract details +type WikiContractProperties struct { + // Collection wiki documents included into this wiki. + Documents []*WikiDocumentationContract +} + +// WikiDocumentationContract - Wiki documentation details. +type WikiDocumentationContract struct { + // Documentation Identifier + DocumentationID *string +} + +// WikiUpdateContract - Wiki update contract details. +type WikiUpdateContract struct { + // Wiki details. + Properties *WikiContractProperties +} + +// WorkspaceAPIClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkspaceAPIClient.BeginCreateOrUpdate +// method. +type WorkspaceAPIClientBeginCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WorkspaceAPIClientDeleteOptions contains the optional parameters for the WorkspaceAPIClient.Delete method. +type WorkspaceAPIClientDeleteOptions struct { + // Delete all revisions of the Api. + DeleteRevisions *bool +} + +// WorkspaceAPIClientGetEntityTagOptions contains the optional parameters for the WorkspaceAPIClient.GetEntityTag method. +type WorkspaceAPIClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIClientGetOptions contains the optional parameters for the WorkspaceAPIClient.Get method. +type WorkspaceAPIClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIClientListByServiceOptions contains the optional parameters for the WorkspaceAPIClient.NewListByServicePager +// method. +type WorkspaceAPIClientListByServiceOptions struct { + // Include full ApiVersionSet resource in response + ExpandAPIVersionSet *bool + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | isCurrent | filter | eq, ne | | + Filter *string + // Number of records to skip. + Skip *int32 + // Include tags in the response. + Tags *string + // Number of records to return. + Top *int32 +} + +// WorkspaceAPIClientUpdateOptions contains the optional parameters for the WorkspaceAPIClient.Update method. +type WorkspaceAPIClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIExportClientGetOptions contains the optional parameters for the WorkspaceAPIExportClient.Get method. +type WorkspaceAPIExportClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIOperationClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceAPIOperationClient.CreateOrUpdate +// method. +type WorkspaceAPIOperationClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// WorkspaceAPIOperationClientDeleteOptions contains the optional parameters for the WorkspaceAPIOperationClient.Delete method. +type WorkspaceAPIOperationClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIOperationClientGetEntityTagOptions contains the optional parameters for the WorkspaceAPIOperationClient.GetEntityTag +// method. +type WorkspaceAPIOperationClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIOperationClientGetOptions contains the optional parameters for the WorkspaceAPIOperationClient.Get method. +type WorkspaceAPIOperationClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIOperationClientListByAPIOptions contains the optional parameters for the WorkspaceAPIOperationClient.NewListByAPIPager +// method. +type WorkspaceAPIOperationClientListByAPIOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Include tags in the response. + Tags *string + // Number of records to return. + Top *int32 +} + +// WorkspaceAPIOperationClientUpdateOptions contains the optional parameters for the WorkspaceAPIOperationClient.Update method. +type WorkspaceAPIOperationClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIOperationPolicyClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceAPIOperationPolicyClient.CreateOrUpdate +// method. +type WorkspaceAPIOperationPolicyClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// WorkspaceAPIOperationPolicyClientDeleteOptions contains the optional parameters for the WorkspaceAPIOperationPolicyClient.Delete +// method. +type WorkspaceAPIOperationPolicyClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIOperationPolicyClientGetEntityTagOptions contains the optional parameters for the WorkspaceAPIOperationPolicyClient.GetEntityTag +// method. +type WorkspaceAPIOperationPolicyClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIOperationPolicyClientGetOptions contains the optional parameters for the WorkspaceAPIOperationPolicyClient.Get +// method. +type WorkspaceAPIOperationPolicyClientGetOptions struct { + // Policy Export Format. + Format *PolicyExportFormat +} + +// WorkspaceAPIOperationPolicyClientListByOperationOptions contains the optional parameters for the WorkspaceAPIOperationPolicyClient.NewListByOperationPager +// method. +type WorkspaceAPIOperationPolicyClientListByOperationOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIPolicyClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceAPIPolicyClient.CreateOrUpdate +// method. +type WorkspaceAPIPolicyClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// WorkspaceAPIPolicyClientDeleteOptions contains the optional parameters for the WorkspaceAPIPolicyClient.Delete method. +type WorkspaceAPIPolicyClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIPolicyClientGetEntityTagOptions contains the optional parameters for the WorkspaceAPIPolicyClient.GetEntityTag +// method. +type WorkspaceAPIPolicyClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIPolicyClientGetOptions contains the optional parameters for the WorkspaceAPIPolicyClient.Get method. +type WorkspaceAPIPolicyClientGetOptions struct { + // Policy Export Format. + Format *PolicyExportFormat +} + +// WorkspaceAPIPolicyClientListByAPIOptions contains the optional parameters for the WorkspaceAPIPolicyClient.NewListByAPIPager +// method. +type WorkspaceAPIPolicyClientListByAPIOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIReleaseClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceAPIReleaseClient.CreateOrUpdate +// method. +type WorkspaceAPIReleaseClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// WorkspaceAPIReleaseClientDeleteOptions contains the optional parameters for the WorkspaceAPIReleaseClient.Delete method. +type WorkspaceAPIReleaseClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIReleaseClientGetEntityTagOptions contains the optional parameters for the WorkspaceAPIReleaseClient.GetEntityTag +// method. +type WorkspaceAPIReleaseClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIReleaseClientGetOptions contains the optional parameters for the WorkspaceAPIReleaseClient.Get method. +type WorkspaceAPIReleaseClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIReleaseClientListByServiceOptions contains the optional parameters for the WorkspaceAPIReleaseClient.NewListByServicePager +// method. +type WorkspaceAPIReleaseClientListByServiceOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceAPIReleaseClientUpdateOptions contains the optional parameters for the WorkspaceAPIReleaseClient.Update method. +type WorkspaceAPIReleaseClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIRevisionClientListByServiceOptions contains the optional parameters for the WorkspaceAPIRevisionClient.NewListByServicePager +// method. +type WorkspaceAPIRevisionClientListByServiceOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceAPISchemaClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkspaceAPISchemaClient.BeginCreateOrUpdate +// method. +type WorkspaceAPISchemaClientBeginCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WorkspaceAPISchemaClientDeleteOptions contains the optional parameters for the WorkspaceAPISchemaClient.Delete method. +type WorkspaceAPISchemaClientDeleteOptions struct { + // If true removes all references to the schema before deleting it. + Force *bool +} + +// WorkspaceAPISchemaClientGetEntityTagOptions contains the optional parameters for the WorkspaceAPISchemaClient.GetEntityTag +// method. +type WorkspaceAPISchemaClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPISchemaClientGetOptions contains the optional parameters for the WorkspaceAPISchemaClient.Get method. +type WorkspaceAPISchemaClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPISchemaClientListByAPIOptions contains the optional parameters for the WorkspaceAPISchemaClient.NewListByAPIPager +// method. +type WorkspaceAPISchemaClientListByAPIOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceAPIVersionSetClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceAPIVersionSetClient.CreateOrUpdate +// method. +type WorkspaceAPIVersionSetClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// WorkspaceAPIVersionSetClientDeleteOptions contains the optional parameters for the WorkspaceAPIVersionSetClient.Delete +// method. +type WorkspaceAPIVersionSetClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIVersionSetClientGetEntityTagOptions contains the optional parameters for the WorkspaceAPIVersionSetClient.GetEntityTag +// method. +type WorkspaceAPIVersionSetClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIVersionSetClientGetOptions contains the optional parameters for the WorkspaceAPIVersionSetClient.Get method. +type WorkspaceAPIVersionSetClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceAPIVersionSetClientListByServiceOptions contains the optional parameters for the WorkspaceAPIVersionSetClient.NewListByServicePager +// method. +type WorkspaceAPIVersionSetClientListByServiceOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceAPIVersionSetClientUpdateOptions contains the optional parameters for the WorkspaceAPIVersionSetClient.Update +// method. +type WorkspaceAPIVersionSetClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceClient.CreateOrUpdate method. +type WorkspaceClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// WorkspaceClientDeleteOptions contains the optional parameters for the WorkspaceClient.Delete method. +type WorkspaceClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceClientGetEntityTagOptions contains the optional parameters for the WorkspaceClient.GetEntityTag method. +type WorkspaceClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceClientGetOptions contains the optional parameters for the WorkspaceClient.Get method. +type WorkspaceClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceClientListByServiceOptions contains the optional parameters for the WorkspaceClient.NewListByServicePager method. +type WorkspaceClientListByServiceOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceClientUpdateOptions contains the optional parameters for the WorkspaceClient.Update method. +type WorkspaceClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceCollection - Paged workspace list representation. +type WorkspaceCollection struct { + // Total record count number across all pages. + Count *int64 + + // Next page link if any. + NextLink *string + + // Page values. + Value []*WorkspaceContract +} + +// WorkspaceContract - Workspace details. +type WorkspaceContract struct { + // Workspace entity contract properties. + Properties *WorkspaceContractProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// WorkspaceContractProperties - Workspace entity properties. +type WorkspaceContractProperties struct { + // REQUIRED; Name of the workspace. + DisplayName *string + + // Description of the workspace. + Description *string +} + +// WorkspaceGlobalSchemaClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkspaceGlobalSchemaClient.BeginCreateOrUpdate +// method. +type WorkspaceGlobalSchemaClientBeginCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WorkspaceGlobalSchemaClientDeleteOptions contains the optional parameters for the WorkspaceGlobalSchemaClient.Delete method. +type WorkspaceGlobalSchemaClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceGlobalSchemaClientGetEntityTagOptions contains the optional parameters for the WorkspaceGlobalSchemaClient.GetEntityTag +// method. +type WorkspaceGlobalSchemaClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceGlobalSchemaClientGetOptions contains the optional parameters for the WorkspaceGlobalSchemaClient.Get method. +type WorkspaceGlobalSchemaClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceGlobalSchemaClientListByServiceOptions contains the optional parameters for the WorkspaceGlobalSchemaClient.NewListByServicePager +// method. +type WorkspaceGlobalSchemaClientListByServiceOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceGroupClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceGroupClient.CreateOrUpdate +// method. +type WorkspaceGroupClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// WorkspaceGroupClientDeleteOptions contains the optional parameters for the WorkspaceGroupClient.Delete method. +type WorkspaceGroupClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceGroupClientGetEntityTagOptions contains the optional parameters for the WorkspaceGroupClient.GetEntityTag method. +type WorkspaceGroupClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceGroupClientGetOptions contains the optional parameters for the WorkspaceGroupClient.Get method. +type WorkspaceGroupClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceGroupClientListByServiceOptions contains the optional parameters for the WorkspaceGroupClient.NewListByServicePager +// method. +type WorkspaceGroupClientListByServiceOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | externalId | filter | eq | | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceGroupClientUpdateOptions contains the optional parameters for the WorkspaceGroupClient.Update method. +type WorkspaceGroupClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceGroupUserClientCheckEntityExistsOptions contains the optional parameters for the WorkspaceGroupUserClient.CheckEntityExists +// method. +type WorkspaceGroupUserClientCheckEntityExistsOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceGroupUserClientCreateOptions contains the optional parameters for the WorkspaceGroupUserClient.Create method. +type WorkspaceGroupUserClientCreateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceGroupUserClientDeleteOptions contains the optional parameters for the WorkspaceGroupUserClient.Delete method. +type WorkspaceGroupUserClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceGroupUserClientListOptions contains the optional parameters for the WorkspaceGroupUserClient.NewListPager method. +type WorkspaceGroupUserClientListOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | registrationDate | filter | ge, le, eq, ne, gt, lt | | + // | note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceNamedValueClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkspaceNamedValueClient.BeginCreateOrUpdate +// method. +type WorkspaceNamedValueClientBeginCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WorkspaceNamedValueClientBeginRefreshSecretOptions contains the optional parameters for the WorkspaceNamedValueClient.BeginRefreshSecret +// method. +type WorkspaceNamedValueClientBeginRefreshSecretOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WorkspaceNamedValueClientBeginUpdateOptions contains the optional parameters for the WorkspaceNamedValueClient.BeginUpdate +// method. +type WorkspaceNamedValueClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WorkspaceNamedValueClientDeleteOptions contains the optional parameters for the WorkspaceNamedValueClient.Delete method. +type WorkspaceNamedValueClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceNamedValueClientGetEntityTagOptions contains the optional parameters for the WorkspaceNamedValueClient.GetEntityTag +// method. +type WorkspaceNamedValueClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceNamedValueClientGetOptions contains the optional parameters for the WorkspaceNamedValueClient.Get method. +type WorkspaceNamedValueClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceNamedValueClientListByServiceOptions contains the optional parameters for the WorkspaceNamedValueClient.NewListByServicePager +// method. +type WorkspaceNamedValueClientListByServiceOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all | + // | displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Query parameter to fetch named value entities based on refresh status. + IsKeyVaultRefreshFailed *KeyVaultRefreshState + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceNamedValueClientListValueOptions contains the optional parameters for the WorkspaceNamedValueClient.ListValue +// method. +type WorkspaceNamedValueClientListValueOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceNotificationClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceNotificationClient.CreateOrUpdate +// method. +type WorkspaceNotificationClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// WorkspaceNotificationClientGetOptions contains the optional parameters for the WorkspaceNotificationClient.Get method. +type WorkspaceNotificationClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceNotificationClientListByServiceOptions contains the optional parameters for the WorkspaceNotificationClient.NewListByServicePager +// method. +type WorkspaceNotificationClientListByServiceOptions struct { + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceNotificationRecipientEmailClientCheckEntityExistsOptions contains the optional parameters for the WorkspaceNotificationRecipientEmailClient.CheckEntityExists +// method. +type WorkspaceNotificationRecipientEmailClientCheckEntityExistsOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceNotificationRecipientEmailClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceNotificationRecipientEmailClient.CreateOrUpdate +// method. +type WorkspaceNotificationRecipientEmailClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceNotificationRecipientEmailClientDeleteOptions contains the optional parameters for the WorkspaceNotificationRecipientEmailClient.Delete +// method. +type WorkspaceNotificationRecipientEmailClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceNotificationRecipientEmailClientListByNotificationOptions contains the optional parameters for the WorkspaceNotificationRecipientEmailClient.ListByNotification +// method. +type WorkspaceNotificationRecipientEmailClientListByNotificationOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceNotificationRecipientUserClientCheckEntityExistsOptions contains the optional parameters for the WorkspaceNotificationRecipientUserClient.CheckEntityExists +// method. +type WorkspaceNotificationRecipientUserClientCheckEntityExistsOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceNotificationRecipientUserClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceNotificationRecipientUserClient.CreateOrUpdate +// method. +type WorkspaceNotificationRecipientUserClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceNotificationRecipientUserClientDeleteOptions contains the optional parameters for the WorkspaceNotificationRecipientUserClient.Delete +// method. +type WorkspaceNotificationRecipientUserClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceNotificationRecipientUserClientListByNotificationOptions contains the optional parameters for the WorkspaceNotificationRecipientUserClient.ListByNotification +// method. +type WorkspaceNotificationRecipientUserClientListByNotificationOptions struct { + // placeholder for future optional parameters +} + +// WorkspacePolicyClientCreateOrUpdateOptions contains the optional parameters for the WorkspacePolicyClient.CreateOrUpdate +// method. +type WorkspacePolicyClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// WorkspacePolicyClientDeleteOptions contains the optional parameters for the WorkspacePolicyClient.Delete method. +type WorkspacePolicyClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspacePolicyClientGetEntityTagOptions contains the optional parameters for the WorkspacePolicyClient.GetEntityTag method. +type WorkspacePolicyClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspacePolicyClientGetOptions contains the optional parameters for the WorkspacePolicyClient.Get method. +type WorkspacePolicyClientGetOptions struct { + // Policy Export Format. + Format *PolicyExportFormat +} + +// WorkspacePolicyClientListByAPIOptions contains the optional parameters for the WorkspacePolicyClient.NewListByAPIPager +// method. +type WorkspacePolicyClientListByAPIOptions struct { + // placeholder for future optional parameters +} + +// WorkspacePolicyFragmentClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkspacePolicyFragmentClient.BeginCreateOrUpdate +// method. +type WorkspacePolicyFragmentClientBeginCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WorkspacePolicyFragmentClientDeleteOptions contains the optional parameters for the WorkspacePolicyFragmentClient.Delete +// method. +type WorkspacePolicyFragmentClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspacePolicyFragmentClientGetEntityTagOptions contains the optional parameters for the WorkspacePolicyFragmentClient.GetEntityTag +// method. +type WorkspacePolicyFragmentClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspacePolicyFragmentClientGetOptions contains the optional parameters for the WorkspacePolicyFragmentClient.Get method. +type WorkspacePolicyFragmentClientGetOptions struct { + // Policy fragment content format. + Format *PolicyFragmentContentFormat +} + +// WorkspacePolicyFragmentClientListByServiceOptions contains the optional parameters for the WorkspacePolicyFragmentClient.NewListByServicePager +// method. +type WorkspacePolicyFragmentClientListByServiceOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // OData order by query option. + Orderby *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspacePolicyFragmentClientListReferencesOptions contains the optional parameters for the WorkspacePolicyFragmentClient.ListReferences +// method. +type WorkspacePolicyFragmentClientListReferencesOptions struct { + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceProductAPILinkClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceProductAPILinkClient.CreateOrUpdate +// method. +type WorkspaceProductAPILinkClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceProductAPILinkClientDeleteOptions contains the optional parameters for the WorkspaceProductAPILinkClient.Delete +// method. +type WorkspaceProductAPILinkClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceProductAPILinkClientGetOptions contains the optional parameters for the WorkspaceProductAPILinkClient.Get method. +type WorkspaceProductAPILinkClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceProductAPILinkClientListByProductOptions contains the optional parameters for the WorkspaceProductAPILinkClient.NewListByProductPager +// method. +type WorkspaceProductAPILinkClientListByProductOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceProductClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceProductClient.CreateOrUpdate +// method. +type WorkspaceProductClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// WorkspaceProductClientDeleteOptions contains the optional parameters for the WorkspaceProductClient.Delete method. +type WorkspaceProductClientDeleteOptions struct { + // Delete existing subscriptions associated with the product or not. + DeleteSubscriptions *bool +} + +// WorkspaceProductClientGetEntityTagOptions contains the optional parameters for the WorkspaceProductClient.GetEntityTag +// method. +type WorkspaceProductClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceProductClientGetOptions contains the optional parameters for the WorkspaceProductClient.Get method. +type WorkspaceProductClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceProductClientListByServiceOptions contains the optional parameters for the WorkspaceProductClient.NewListByServicePager +// method. +type WorkspaceProductClientListByServiceOptions struct { + // When set to true, the response contains an array of groups that have visibility to the product. The default is false. + ExpandGroups *bool + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | state | filter | eq | | + // | groups | expand | | | + Filter *string + // Number of records to skip. + Skip *int32 + // Products which are part of a specific tag. + Tags *string + // Number of records to return. + Top *int32 +} + +// WorkspaceProductClientUpdateOptions contains the optional parameters for the WorkspaceProductClient.Update method. +type WorkspaceProductClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceProductGroupLinkClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceProductGroupLinkClient.CreateOrUpdate +// method. +type WorkspaceProductGroupLinkClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceProductGroupLinkClientDeleteOptions contains the optional parameters for the WorkspaceProductGroupLinkClient.Delete +// method. +type WorkspaceProductGroupLinkClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceProductGroupLinkClientGetOptions contains the optional parameters for the WorkspaceProductGroupLinkClient.Get +// method. +type WorkspaceProductGroupLinkClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceProductGroupLinkClientListByProductOptions contains the optional parameters for the WorkspaceProductGroupLinkClient.NewListByProductPager +// method. +type WorkspaceProductGroupLinkClientListByProductOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceProductPolicyClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceProductPolicyClient.CreateOrUpdate +// method. +type WorkspaceProductPolicyClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// WorkspaceProductPolicyClientDeleteOptions contains the optional parameters for the WorkspaceProductPolicyClient.Delete +// method. +type WorkspaceProductPolicyClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceProductPolicyClientGetEntityTagOptions contains the optional parameters for the WorkspaceProductPolicyClient.GetEntityTag +// method. +type WorkspaceProductPolicyClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceProductPolicyClientGetOptions contains the optional parameters for the WorkspaceProductPolicyClient.Get method. +type WorkspaceProductPolicyClientGetOptions struct { + // Policy Export Format. + Format *PolicyExportFormat +} + +// WorkspaceProductPolicyClientListByProductOptions contains the optional parameters for the WorkspaceProductPolicyClient.ListByProduct +// method. +type WorkspaceProductPolicyClientListByProductOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceSubscriptionClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceSubscriptionClient.CreateOrUpdate +// method. +type WorkspaceSubscriptionClientCreateOrUpdateOptions struct { + // Determines the type of application which send the create user request. Default is legacy publisher portal. + AppType *AppType + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string + // Notify change in Subscription State. + // * If false, do not send any email notification for change of state of subscription + // * If true, send email notification of change of state of subscription + Notify *bool +} + +// WorkspaceSubscriptionClientDeleteOptions contains the optional parameters for the WorkspaceSubscriptionClient.Delete method. +type WorkspaceSubscriptionClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceSubscriptionClientGetEntityTagOptions contains the optional parameters for the WorkspaceSubscriptionClient.GetEntityTag +// method. +type WorkspaceSubscriptionClientGetEntityTagOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceSubscriptionClientGetOptions contains the optional parameters for the WorkspaceSubscriptionClient.Get method. +type WorkspaceSubscriptionClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceSubscriptionClientListOptions contains the optional parameters for the WorkspaceSubscriptionClient.NewListPager +// method. +type WorkspaceSubscriptionClientListOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | state | filter | eq | | + // | user | expand | | | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceSubscriptionClientListSecretsOptions contains the optional parameters for the WorkspaceSubscriptionClient.ListSecrets +// method. +type WorkspaceSubscriptionClientListSecretsOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceSubscriptionClientRegeneratePrimaryKeyOptions contains the optional parameters for the WorkspaceSubscriptionClient.RegeneratePrimaryKey +// method. +type WorkspaceSubscriptionClientRegeneratePrimaryKeyOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceSubscriptionClientRegenerateSecondaryKeyOptions contains the optional parameters for the WorkspaceSubscriptionClient.RegenerateSecondaryKey +// method. +type WorkspaceSubscriptionClientRegenerateSecondaryKeyOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceSubscriptionClientUpdateOptions contains the optional parameters for the WorkspaceSubscriptionClient.Update method. +type WorkspaceSubscriptionClientUpdateOptions struct { + // Determines the type of application which send the create user request. Default is legacy publisher portal. + AppType *AppType + // Notify change in Subscription State. + // * If false, do not send any email notification for change of state of subscription + // * If true, send email notification of change of state of subscription + Notify *bool +} + +// WorkspaceTagAPILinkClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceTagAPILinkClient.CreateOrUpdate +// method. +type WorkspaceTagAPILinkClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceTagAPILinkClientDeleteOptions contains the optional parameters for the WorkspaceTagAPILinkClient.Delete method. +type WorkspaceTagAPILinkClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceTagAPILinkClientGetOptions contains the optional parameters for the WorkspaceTagAPILinkClient.Get method. +type WorkspaceTagAPILinkClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceTagAPILinkClientListByProductOptions contains the optional parameters for the WorkspaceTagAPILinkClient.NewListByProductPager +// method. +type WorkspaceTagAPILinkClientListByProductOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceTagClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceTagClient.CreateOrUpdate method. +type WorkspaceTagClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity, but required when updating an entity. + IfMatch *string +} + +// WorkspaceTagClientDeleteOptions contains the optional parameters for the WorkspaceTagClient.Delete method. +type WorkspaceTagClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceTagClientGetEntityStateOptions contains the optional parameters for the WorkspaceTagClient.GetEntityState method. +type WorkspaceTagClientGetEntityStateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceTagClientGetOptions contains the optional parameters for the WorkspaceTagClient.Get method. +type WorkspaceTagClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceTagClientListByServiceOptions contains the optional parameters for the WorkspaceTagClient.NewListByServicePager +// method. +type WorkspaceTagClientListByServiceOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + // | displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Scope like 'apis', 'products' or 'apis/{apiId} + Scope *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceTagClientUpdateOptions contains the optional parameters for the WorkspaceTagClient.Update method. +type WorkspaceTagClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceTagOperationLinkClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceTagOperationLinkClient.CreateOrUpdate +// method. +type WorkspaceTagOperationLinkClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceTagOperationLinkClientDeleteOptions contains the optional parameters for the WorkspaceTagOperationLinkClient.Delete +// method. +type WorkspaceTagOperationLinkClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceTagOperationLinkClientGetOptions contains the optional parameters for the WorkspaceTagOperationLinkClient.Get +// method. +type WorkspaceTagOperationLinkClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceTagOperationLinkClientListByProductOptions contains the optional parameters for the WorkspaceTagOperationLinkClient.NewListByProductPager +// method. +type WorkspaceTagOperationLinkClientListByProductOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + +// WorkspaceTagProductLinkClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceTagProductLinkClient.CreateOrUpdate +// method. +type WorkspaceTagProductLinkClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceTagProductLinkClientDeleteOptions contains the optional parameters for the WorkspaceTagProductLinkClient.Delete +// method. +type WorkspaceTagProductLinkClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceTagProductLinkClientGetOptions contains the optional parameters for the WorkspaceTagProductLinkClient.Get method. +type WorkspaceTagProductLinkClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspaceTagProductLinkClientListByProductOptions contains the optional parameters for the WorkspaceTagProductLinkClient.NewListByProductPager +// method. +type WorkspaceTagProductLinkClientListByProductOptions struct { + // | Field | Usage | Supported operators | Supported functions | + // |-------------|-------------|-------------|-------------| + // | productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | + Filter *string + // Number of records to skip. + Skip *int32 + // Number of records to return. + Top *int32 +} + // X509CertificateName - Properties of server X509Names. type X509CertificateName struct { // Thumbprint for the Issuer of the Certificate. diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/models_serde.go b/sdk/resourcemanager/apimanagement/armapimanagement/models_serde.go index 7aa96a7f0f21..9c7fe9d967cb 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/models_serde.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/models_serde.go @@ -384,6 +384,7 @@ func (a APICreateOrUpdateProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "subscriptionKeyParameterNames", a.SubscriptionKeyParameterNames) populate(objectMap, "subscriptionRequired", a.SubscriptionRequired) populate(objectMap, "termsOfServiceUrl", a.TermsOfServiceURL) + populate(objectMap, "translateRequiredQueryParameters", a.TranslateRequiredQueryParametersConduct) populate(objectMap, "value", a.Value) populate(objectMap, "wsdlSelector", a.WsdlSelector) return json.Marshal(objectMap) @@ -467,6 +468,9 @@ func (a *APICreateOrUpdateProperties) UnmarshalJSON(data []byte) error { case "termsOfServiceUrl": err = unpopulate(val, "TermsOfServiceURL", &a.TermsOfServiceURL) delete(rawMsg, key) + case "translateRequiredQueryParameters": + err = unpopulate(val, "TranslateRequiredQueryParametersConduct", &a.TranslateRequiredQueryParametersConduct) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) @@ -1634,6 +1638,8 @@ func (a AdditionalLocation) MarshalJSON() ([]byte, error) { populate(objectMap, "disableGateway", a.DisableGateway) populate(objectMap, "gatewayRegionalUrl", a.GatewayRegionalURL) populate(objectMap, "location", a.Location) + populate(objectMap, "natGatewayState", a.NatGatewayState) + populate(objectMap, "outboundPublicIPAddresses", a.OutboundPublicIPAddresses) populate(objectMap, "platformVersion", a.PlatformVersion) populate(objectMap, "privateIPAddresses", a.PrivateIPAddresses) populate(objectMap, "publicIpAddressId", a.PublicIPAddressID) @@ -1662,6 +1668,12 @@ func (a *AdditionalLocation) UnmarshalJSON(data []byte) error { case "location": err = unpopulate(val, "Location", &a.Location) delete(rawMsg, key) + case "natGatewayState": + err = unpopulate(val, "NatGatewayState", &a.NatGatewayState) + delete(rawMsg, key) + case "outboundPublicIPAddresses": + err = unpopulate(val, "OutboundPublicIPAddresses", &a.OutboundPublicIPAddresses) + delete(rawMsg, key) case "platformVersion": err = unpopulate(val, "PlatformVersion", &a.PlatformVersion) delete(rawMsg, key) @@ -1827,7 +1839,9 @@ func (a *AssociationContractProperties) UnmarshalJSON(data []byte) error { func (a AuthenticationSettingsContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "oAuth2", a.OAuth2) + populate(objectMap, "oAuth2AuthenticationSettings", a.OAuth2AuthenticationSettings) populate(objectMap, "openid", a.Openid) + populate(objectMap, "openidAuthenticationSettings", a.OpenidAuthenticationSettings) return json.Marshal(objectMap) } @@ -1843,9 +1857,15 @@ func (a *AuthenticationSettingsContract) UnmarshalJSON(data []byte) error { case "oAuth2": err = unpopulate(val, "OAuth2", &a.OAuth2) delete(rawMsg, key) + case "oAuth2AuthenticationSettings": + err = unpopulate(val, "OAuth2AuthenticationSettings", &a.OAuth2AuthenticationSettings) + delete(rawMsg, key) case "openid": err = unpopulate(val, "Openid", &a.Openid) delete(rawMsg, key) + case "openidAuthenticationSettings": + err = unpopulate(val, "OpenidAuthenticationSettings", &a.OpenidAuthenticationSettings) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -1854,8 +1874,8 @@ func (a *AuthenticationSettingsContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AuthorizationServerCollection. -func (a AuthorizationServerCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationAccessPolicyCollection. +func (a AuthorizationAccessPolicyCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "count", a.Count) populate(objectMap, "nextLink", a.NextLink) @@ -1863,8 +1883,8 @@ func (a AuthorizationServerCollection) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationServerCollection. -func (a *AuthorizationServerCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationAccessPolicyCollection. +func (a *AuthorizationAccessPolicyCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -1889,8 +1909,8 @@ func (a *AuthorizationServerCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AuthorizationServerContract. -func (a AuthorizationServerContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationAccessPolicyContract. +func (a AuthorizationAccessPolicyContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) @@ -1899,8 +1919,8 @@ func (a AuthorizationServerContract) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationServerContract. -func (a *AuthorizationServerContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationAccessPolicyContract. +func (a *AuthorizationAccessPolicyContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -1928,24 +1948,16 @@ func (a *AuthorizationServerContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AuthorizationServerContractBaseProperties. -func (a AuthorizationServerContractBaseProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationAccessPolicyContractProperties. +func (a AuthorizationAccessPolicyContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "authorizationMethods", a.AuthorizationMethods) - populate(objectMap, "bearerTokenSendingMethods", a.BearerTokenSendingMethods) - populate(objectMap, "clientAuthenticationMethod", a.ClientAuthenticationMethod) - populate(objectMap, "defaultScope", a.DefaultScope) - populate(objectMap, "description", a.Description) - populate(objectMap, "resourceOwnerPassword", a.ResourceOwnerPassword) - populate(objectMap, "resourceOwnerUsername", a.ResourceOwnerUsername) - populate(objectMap, "supportState", a.SupportState) - populate(objectMap, "tokenBodyParameters", a.TokenBodyParameters) - populate(objectMap, "tokenEndpoint", a.TokenEndpoint) + populate(objectMap, "objectId", a.ObjectID) + populate(objectMap, "tenantId", a.TenantID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationServerContractBaseProperties. -func (a *AuthorizationServerContractBaseProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationAccessPolicyContractProperties. +func (a *AuthorizationAccessPolicyContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -1953,35 +1965,11 @@ func (a *AuthorizationServerContractBaseProperties) UnmarshalJSON(data []byte) e for key, val := range rawMsg { var err error switch key { - case "authorizationMethods": - err = unpopulate(val, "AuthorizationMethods", &a.AuthorizationMethods) - delete(rawMsg, key) - case "bearerTokenSendingMethods": - err = unpopulate(val, "BearerTokenSendingMethods", &a.BearerTokenSendingMethods) + case "objectId": + err = unpopulate(val, "ObjectID", &a.ObjectID) delete(rawMsg, key) - case "clientAuthenticationMethod": - err = unpopulate(val, "ClientAuthenticationMethod", &a.ClientAuthenticationMethod) - delete(rawMsg, key) - case "defaultScope": - err = unpopulate(val, "DefaultScope", &a.DefaultScope) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "resourceOwnerPassword": - err = unpopulate(val, "ResourceOwnerPassword", &a.ResourceOwnerPassword) - delete(rawMsg, key) - case "resourceOwnerUsername": - err = unpopulate(val, "ResourceOwnerUsername", &a.ResourceOwnerUsername) - delete(rawMsg, key) - case "supportState": - err = unpopulate(val, "SupportState", &a.SupportState) - delete(rawMsg, key) - case "tokenBodyParameters": - err = unpopulate(val, "TokenBodyParameters", &a.TokenBodyParameters) - delete(rawMsg, key) - case "tokenEndpoint": - err = unpopulate(val, "TokenEndpoint", &a.TokenEndpoint) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) delete(rawMsg, key) } if err != nil { @@ -1991,30 +1979,17 @@ func (a *AuthorizationServerContractBaseProperties) UnmarshalJSON(data []byte) e return nil } -// MarshalJSON implements the json.Marshaller interface for type AuthorizationServerContractProperties. -func (a AuthorizationServerContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationCollection. +func (a AuthorizationCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "authorizationEndpoint", a.AuthorizationEndpoint) - populate(objectMap, "authorizationMethods", a.AuthorizationMethods) - populate(objectMap, "bearerTokenSendingMethods", a.BearerTokenSendingMethods) - populate(objectMap, "clientAuthenticationMethod", a.ClientAuthenticationMethod) - populate(objectMap, "clientId", a.ClientID) - populate(objectMap, "clientRegistrationEndpoint", a.ClientRegistrationEndpoint) - populate(objectMap, "clientSecret", a.ClientSecret) - populate(objectMap, "defaultScope", a.DefaultScope) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "grantTypes", a.GrantTypes) - populate(objectMap, "resourceOwnerPassword", a.ResourceOwnerPassword) - populate(objectMap, "resourceOwnerUsername", a.ResourceOwnerUsername) - populate(objectMap, "supportState", a.SupportState) - populate(objectMap, "tokenBodyParameters", a.TokenBodyParameters) - populate(objectMap, "tokenEndpoint", a.TokenEndpoint) + populate(objectMap, "count", a.Count) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationServerContractProperties. -func (a *AuthorizationServerContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationCollection. +func (a *AuthorizationCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2022,53 +1997,14 @@ func (a *AuthorizationServerContractProperties) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "authorizationEndpoint": - err = unpopulate(val, "AuthorizationEndpoint", &a.AuthorizationEndpoint) - delete(rawMsg, key) - case "authorizationMethods": - err = unpopulate(val, "AuthorizationMethods", &a.AuthorizationMethods) - delete(rawMsg, key) - case "bearerTokenSendingMethods": - err = unpopulate(val, "BearerTokenSendingMethods", &a.BearerTokenSendingMethods) - delete(rawMsg, key) - case "clientAuthenticationMethod": - err = unpopulate(val, "ClientAuthenticationMethod", &a.ClientAuthenticationMethod) - delete(rawMsg, key) - case "clientId": - err = unpopulate(val, "ClientID", &a.ClientID) - delete(rawMsg, key) - case "clientRegistrationEndpoint": - err = unpopulate(val, "ClientRegistrationEndpoint", &a.ClientRegistrationEndpoint) - delete(rawMsg, key) - case "clientSecret": - err = unpopulate(val, "ClientSecret", &a.ClientSecret) - delete(rawMsg, key) - case "defaultScope": - err = unpopulate(val, "DefaultScope", &a.DefaultScope) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "grantTypes": - err = unpopulate(val, "GrantTypes", &a.GrantTypes) - delete(rawMsg, key) - case "resourceOwnerPassword": - err = unpopulate(val, "ResourceOwnerPassword", &a.ResourceOwnerPassword) - delete(rawMsg, key) - case "resourceOwnerUsername": - err = unpopulate(val, "ResourceOwnerUsername", &a.ResourceOwnerUsername) - delete(rawMsg, key) - case "supportState": - err = unpopulate(val, "SupportState", &a.SupportState) + case "count": + err = unpopulate(val, "Count", &a.Count) delete(rawMsg, key) - case "tokenBodyParameters": - err = unpopulate(val, "TokenBodyParameters", &a.TokenBodyParameters) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "tokenEndpoint": - err = unpopulate(val, "TokenEndpoint", &a.TokenEndpoint) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { @@ -2078,17 +2014,15 @@ func (a *AuthorizationServerContractProperties) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type AuthorizationServerSecretsContract. -func (a AuthorizationServerSecretsContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationConfirmConsentCodeRequestContract. +func (a AuthorizationConfirmConsentCodeRequestContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientSecret", a.ClientSecret) - populate(objectMap, "resourceOwnerPassword", a.ResourceOwnerPassword) - populate(objectMap, "resourceOwnerUsername", a.ResourceOwnerUsername) + populate(objectMap, "consentCode", a.ConsentCode) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationServerSecretsContract. -func (a *AuthorizationServerSecretsContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationConfirmConsentCodeRequestContract. +func (a *AuthorizationConfirmConsentCodeRequestContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2096,14 +2030,8 @@ func (a *AuthorizationServerSecretsContract) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "clientSecret": - err = unpopulate(val, "ClientSecret", &a.ClientSecret) - delete(rawMsg, key) - case "resourceOwnerPassword": - err = unpopulate(val, "ResourceOwnerPassword", &a.ResourceOwnerPassword) - delete(rawMsg, key) - case "resourceOwnerUsername": - err = unpopulate(val, "ResourceOwnerUsername", &a.ResourceOwnerUsername) + case "consentCode": + err = unpopulate(val, "ConsentCode", &a.ConsentCode) delete(rawMsg, key) } if err != nil { @@ -2113,8 +2041,8 @@ func (a *AuthorizationServerSecretsContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AuthorizationServerUpdateContract. -func (a AuthorizationServerUpdateContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationContract. +func (a AuthorizationContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) @@ -2123,8 +2051,8 @@ func (a AuthorizationServerUpdateContract) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationServerUpdateContract. -func (a *AuthorizationServerUpdateContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationContract. +func (a *AuthorizationContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2152,30 +2080,19 @@ func (a *AuthorizationServerUpdateContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AuthorizationServerUpdateContractProperties. -func (a AuthorizationServerUpdateContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationContractProperties. +func (a AuthorizationContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "authorizationEndpoint", a.AuthorizationEndpoint) - populate(objectMap, "authorizationMethods", a.AuthorizationMethods) - populate(objectMap, "bearerTokenSendingMethods", a.BearerTokenSendingMethods) - populate(objectMap, "clientAuthenticationMethod", a.ClientAuthenticationMethod) - populate(objectMap, "clientId", a.ClientID) - populate(objectMap, "clientRegistrationEndpoint", a.ClientRegistrationEndpoint) - populate(objectMap, "clientSecret", a.ClientSecret) - populate(objectMap, "defaultScope", a.DefaultScope) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "grantTypes", a.GrantTypes) - populate(objectMap, "resourceOwnerPassword", a.ResourceOwnerPassword) - populate(objectMap, "resourceOwnerUsername", a.ResourceOwnerUsername) - populate(objectMap, "supportState", a.SupportState) - populate(objectMap, "tokenBodyParameters", a.TokenBodyParameters) - populate(objectMap, "tokenEndpoint", a.TokenEndpoint) + populate(objectMap, "authorizationType", a.AuthorizationType) + populate(objectMap, "error", a.Error) + populate(objectMap, "oauth2grantType", a.OAuth2GrantType) + populate(objectMap, "parameters", a.Parameters) + populate(objectMap, "status", a.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationServerUpdateContractProperties. -func (a *AuthorizationServerUpdateContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationContractProperties. +func (a *AuthorizationContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2183,53 +2100,20 @@ func (a *AuthorizationServerUpdateContractProperties) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "authorizationEndpoint": - err = unpopulate(val, "AuthorizationEndpoint", &a.AuthorizationEndpoint) - delete(rawMsg, key) - case "authorizationMethods": - err = unpopulate(val, "AuthorizationMethods", &a.AuthorizationMethods) - delete(rawMsg, key) - case "bearerTokenSendingMethods": - err = unpopulate(val, "BearerTokenSendingMethods", &a.BearerTokenSendingMethods) - delete(rawMsg, key) - case "clientAuthenticationMethod": - err = unpopulate(val, "ClientAuthenticationMethod", &a.ClientAuthenticationMethod) - delete(rawMsg, key) - case "clientId": - err = unpopulate(val, "ClientID", &a.ClientID) - delete(rawMsg, key) - case "clientRegistrationEndpoint": - err = unpopulate(val, "ClientRegistrationEndpoint", &a.ClientRegistrationEndpoint) - delete(rawMsg, key) - case "clientSecret": - err = unpopulate(val, "ClientSecret", &a.ClientSecret) - delete(rawMsg, key) - case "defaultScope": - err = unpopulate(val, "DefaultScope", &a.DefaultScope) + case "authorizationType": + err = unpopulate(val, "AuthorizationType", &a.AuthorizationType) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "grantTypes": - err = unpopulate(val, "GrantTypes", &a.GrantTypes) - delete(rawMsg, key) - case "resourceOwnerPassword": - err = unpopulate(val, "ResourceOwnerPassword", &a.ResourceOwnerPassword) - delete(rawMsg, key) - case "resourceOwnerUsername": - err = unpopulate(val, "ResourceOwnerUsername", &a.ResourceOwnerUsername) + case "error": + err = unpopulate(val, "Error", &a.Error) delete(rawMsg, key) - case "supportState": - err = unpopulate(val, "SupportState", &a.SupportState) + case "oauth2grantType": + err = unpopulate(val, "OAuth2GrantType", &a.OAuth2GrantType) delete(rawMsg, key) - case "tokenBodyParameters": - err = unpopulate(val, "TokenBodyParameters", &a.TokenBodyParameters) + case "parameters": + err = unpopulate(val, "Parameters", &a.Parameters) delete(rawMsg, key) - case "tokenEndpoint": - err = unpopulate(val, "TokenEndpoint", &a.TokenEndpoint) + case "status": + err = unpopulate(val, "Status", &a.Status) delete(rawMsg, key) } if err != nil { @@ -2239,406 +2123,1257 @@ func (a *AuthorizationServerUpdateContractProperties) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type BackendAuthorizationHeaderCredentials. -func (b BackendAuthorizationHeaderCredentials) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationError. +func (a AuthorizationError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "parameter", b.Parameter) - populate(objectMap, "scheme", b.Scheme) + populate(objectMap, "code", a.Code) + populate(objectMap, "message", a.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackendAuthorizationHeaderCredentials. -func (b *BackendAuthorizationHeaderCredentials) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationError. +func (a *AuthorizationError) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "parameter": - err = unpopulate(val, "Parameter", &b.Parameter) + case "code": + err = unpopulate(val, "Code", &a.Code) delete(rawMsg, key) - case "scheme": - err = unpopulate(val, "Scheme", &b.Scheme) + case "message": + err = unpopulate(val, "Message", &a.Message) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BackendBaseParameters. -func (b BackendBaseParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationLoginRequestContract. +func (a AuthorizationLoginRequestContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "credentials", b.Credentials) - populate(objectMap, "description", b.Description) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "proxy", b.Proxy) - populate(objectMap, "resourceId", b.ResourceID) - populate(objectMap, "tls", b.TLS) - populate(objectMap, "title", b.Title) + populate(objectMap, "postLoginRedirectUrl", a.PostLoginRedirectURL) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackendBaseParameters. -func (b *BackendBaseParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationLoginRequestContract. +func (a *AuthorizationLoginRequestContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "credentials": - err = unpopulate(val, "Credentials", &b.Credentials) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &b.Description) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &b.Properties) - delete(rawMsg, key) - case "proxy": - err = unpopulate(val, "Proxy", &b.Proxy) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &b.ResourceID) - delete(rawMsg, key) - case "tls": - err = unpopulate(val, "TLS", &b.TLS) - delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &b.Title) + case "postLoginRedirectUrl": + err = unpopulate(val, "PostLoginRedirectURL", &a.PostLoginRedirectURL) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BackendCollection. -func (b BackendCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationLoginResponseContract. +func (a AuthorizationLoginResponseContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", b.Count) - populate(objectMap, "nextLink", b.NextLink) - populate(objectMap, "value", b.Value) + populate(objectMap, "loginLink", a.LoginLink) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackendCollection. -func (b *BackendCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationLoginResponseContract. +func (a *AuthorizationLoginResponseContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &b.Count) - delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &b.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &b.Value) + case "loginLink": + err = unpopulate(val, "LoginLink", &a.LoginLink) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BackendContract. -func (b BackendContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationProviderCollection. +func (a AuthorizationProviderCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", b.ID) - populate(objectMap, "name", b.Name) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "type", b.Type) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackendContract. -func (b *BackendContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationProviderCollection. +func (a *AuthorizationProviderCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &b.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &b.Properties) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &b.Type) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BackendContractProperties. -func (b BackendContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationProviderContract. +func (a AuthorizationProviderContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "credentials", b.Credentials) - populate(objectMap, "description", b.Description) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "protocol", b.Protocol) - populate(objectMap, "proxy", b.Proxy) - populate(objectMap, "resourceId", b.ResourceID) - populate(objectMap, "tls", b.TLS) - populate(objectMap, "title", b.Title) - populate(objectMap, "url", b.URL) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackendContractProperties. -func (b *BackendContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationProviderContract. +func (a *AuthorizationProviderContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "credentials": - err = unpopulate(val, "Credentials", &b.Credentials) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &b.Description) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &b.Properties) - delete(rawMsg, key) - case "protocol": - err = unpopulate(val, "Protocol", &b.Protocol) - delete(rawMsg, key) - case "proxy": - err = unpopulate(val, "Proxy", &b.Proxy) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &b.ResourceID) - delete(rawMsg, key) - case "tls": - err = unpopulate(val, "TLS", &b.TLS) - delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &b.Title) + err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) - case "url": - err = unpopulate(val, "URL", &b.URL) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BackendCredentialsContract. -func (b BackendCredentialsContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationProviderContractProperties. +func (a AuthorizationProviderContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "authorization", b.Authorization) - populate(objectMap, "certificate", b.Certificate) - populate(objectMap, "certificateIds", b.CertificateIDs) - populate(objectMap, "header", b.Header) - populate(objectMap, "query", b.Query) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "identityProvider", a.IdentityProvider) + populate(objectMap, "oauth2", a.Oauth2) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackendCredentialsContract. -func (b *BackendCredentialsContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationProviderContractProperties. +func (a *AuthorizationProviderContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "authorization": - err = unpopulate(val, "Authorization", &b.Authorization) - delete(rawMsg, key) - case "certificate": - err = unpopulate(val, "Certificate", &b.Certificate) - delete(rawMsg, key) - case "certificateIds": - err = unpopulate(val, "CertificateIDs", &b.CertificateIDs) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) delete(rawMsg, key) - case "header": - err = unpopulate(val, "Header", &b.Header) + case "identityProvider": + err = unpopulate(val, "IdentityProvider", &a.IdentityProvider) delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &b.Query) + case "oauth2": + err = unpopulate(val, "Oauth2", &a.Oauth2) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BackendProperties. -func (b BackendProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationProviderOAuth2GrantTypes. +func (a AuthorizationProviderOAuth2GrantTypes) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "serviceFabricCluster", b.ServiceFabricCluster) + populate(objectMap, "authorizationCode", a.AuthorizationCode) + populate(objectMap, "clientCredentials", a.ClientCredentials) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackendProperties. -func (b *BackendProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationProviderOAuth2GrantTypes. +func (a *AuthorizationProviderOAuth2GrantTypes) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "serviceFabricCluster": - err = unpopulate(val, "ServiceFabricCluster", &b.ServiceFabricCluster) + case "authorizationCode": + err = unpopulate(val, "AuthorizationCode", &a.AuthorizationCode) + delete(rawMsg, key) + case "clientCredentials": + err = unpopulate(val, "ClientCredentials", &a.ClientCredentials) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BackendProxyContract. -func (b BackendProxyContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationProviderOAuth2Settings. +func (a AuthorizationProviderOAuth2Settings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "password", b.Password) - populate(objectMap, "url", b.URL) - populate(objectMap, "username", b.Username) + populate(objectMap, "grantTypes", a.GrantTypes) + populate(objectMap, "redirectUrl", a.RedirectURL) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackendProxyContract. -func (b *BackendProxyContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationProviderOAuth2Settings. +func (a *AuthorizationProviderOAuth2Settings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "password": - err = unpopulate(val, "Password", &b.Password) - delete(rawMsg, key) - case "url": - err = unpopulate(val, "URL", &b.URL) + case "grantTypes": + err = unpopulate(val, "GrantTypes", &a.GrantTypes) delete(rawMsg, key) - case "username": - err = unpopulate(val, "Username", &b.Username) + case "redirectUrl": + err = unpopulate(val, "RedirectURL", &a.RedirectURL) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BackendReconnectContract. -func (b BackendReconnectContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationServerCollection. +func (a AuthorizationServerCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", b.ID) - populate(objectMap, "name", b.Name) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "type", b.Type) + populate(objectMap, "count", a.Count) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackendReconnectContract. -func (b *BackendReconnectContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationServerCollection. +func (a *AuthorizationServerCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &b.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) + case "count": + err = unpopulate(val, "Count", &a.Count) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &b.Properties) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &b.Type) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BackendReconnectProperties. -func (b BackendReconnectProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationServerContract. +func (a AuthorizationServerContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "after", b.After) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackendReconnectProperties. -func (b *BackendReconnectProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationServerContract. +func (a *AuthorizationServerContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "after": - err = unpopulate(val, "After", &b.After) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BackendServiceFabricClusterProperties. -func (b BackendServiceFabricClusterProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthorizationServerContractBaseProperties. +func (a AuthorizationServerContractBaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientCertificateId", b.ClientCertificateID) - populate(objectMap, "clientCertificatethumbprint", b.ClientCertificatethumbprint) - populate(objectMap, "managementEndpoints", b.ManagementEndpoints) - populate(objectMap, "maxPartitionResolutionRetries", b.MaxPartitionResolutionRetries) - populate(objectMap, "serverCertificateThumbprints", b.ServerCertificateThumbprints) - populate(objectMap, "serverX509Names", b.ServerX509Names) + populate(objectMap, "authorizationMethods", a.AuthorizationMethods) + populate(objectMap, "bearerTokenSendingMethods", a.BearerTokenSendingMethods) + populate(objectMap, "clientAuthenticationMethod", a.ClientAuthenticationMethod) + populate(objectMap, "defaultScope", a.DefaultScope) + populate(objectMap, "description", a.Description) + populate(objectMap, "resourceOwnerPassword", a.ResourceOwnerPassword) + populate(objectMap, "resourceOwnerUsername", a.ResourceOwnerUsername) + populate(objectMap, "supportState", a.SupportState) + populate(objectMap, "tokenBodyParameters", a.TokenBodyParameters) + populate(objectMap, "tokenEndpoint", a.TokenEndpoint) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackendServiceFabricClusterProperties. -func (b *BackendServiceFabricClusterProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationServerContractBaseProperties. +func (a *AuthorizationServerContractBaseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizationMethods": + err = unpopulate(val, "AuthorizationMethods", &a.AuthorizationMethods) + delete(rawMsg, key) + case "bearerTokenSendingMethods": + err = unpopulate(val, "BearerTokenSendingMethods", &a.BearerTokenSendingMethods) + delete(rawMsg, key) + case "clientAuthenticationMethod": + err = unpopulate(val, "ClientAuthenticationMethod", &a.ClientAuthenticationMethod) + delete(rawMsg, key) + case "defaultScope": + err = unpopulate(val, "DefaultScope", &a.DefaultScope) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "resourceOwnerPassword": + err = unpopulate(val, "ResourceOwnerPassword", &a.ResourceOwnerPassword) + delete(rawMsg, key) + case "resourceOwnerUsername": + err = unpopulate(val, "ResourceOwnerUsername", &a.ResourceOwnerUsername) + delete(rawMsg, key) + case "supportState": + err = unpopulate(val, "SupportState", &a.SupportState) + delete(rawMsg, key) + case "tokenBodyParameters": + err = unpopulate(val, "TokenBodyParameters", &a.TokenBodyParameters) + delete(rawMsg, key) + case "tokenEndpoint": + err = unpopulate(val, "TokenEndpoint", &a.TokenEndpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthorizationServerContractProperties. +func (a AuthorizationServerContractProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authorizationEndpoint", a.AuthorizationEndpoint) + populate(objectMap, "authorizationMethods", a.AuthorizationMethods) + populate(objectMap, "bearerTokenSendingMethods", a.BearerTokenSendingMethods) + populate(objectMap, "clientAuthenticationMethod", a.ClientAuthenticationMethod) + populate(objectMap, "clientId", a.ClientID) + populate(objectMap, "clientRegistrationEndpoint", a.ClientRegistrationEndpoint) + populate(objectMap, "clientSecret", a.ClientSecret) + populate(objectMap, "defaultScope", a.DefaultScope) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "grantTypes", a.GrantTypes) + populate(objectMap, "resourceOwnerPassword", a.ResourceOwnerPassword) + populate(objectMap, "resourceOwnerUsername", a.ResourceOwnerUsername) + populate(objectMap, "supportState", a.SupportState) + populate(objectMap, "tokenBodyParameters", a.TokenBodyParameters) + populate(objectMap, "tokenEndpoint", a.TokenEndpoint) + populate(objectMap, "useInApiDocumentation", a.UseInAPIDocumentation) + populate(objectMap, "useInTestConsole", a.UseInTestConsole) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationServerContractProperties. +func (a *AuthorizationServerContractProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizationEndpoint": + err = unpopulate(val, "AuthorizationEndpoint", &a.AuthorizationEndpoint) + delete(rawMsg, key) + case "authorizationMethods": + err = unpopulate(val, "AuthorizationMethods", &a.AuthorizationMethods) + delete(rawMsg, key) + case "bearerTokenSendingMethods": + err = unpopulate(val, "BearerTokenSendingMethods", &a.BearerTokenSendingMethods) + delete(rawMsg, key) + case "clientAuthenticationMethod": + err = unpopulate(val, "ClientAuthenticationMethod", &a.ClientAuthenticationMethod) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &a.ClientID) + delete(rawMsg, key) + case "clientRegistrationEndpoint": + err = unpopulate(val, "ClientRegistrationEndpoint", &a.ClientRegistrationEndpoint) + delete(rawMsg, key) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &a.ClientSecret) + delete(rawMsg, key) + case "defaultScope": + err = unpopulate(val, "DefaultScope", &a.DefaultScope) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "grantTypes": + err = unpopulate(val, "GrantTypes", &a.GrantTypes) + delete(rawMsg, key) + case "resourceOwnerPassword": + err = unpopulate(val, "ResourceOwnerPassword", &a.ResourceOwnerPassword) + delete(rawMsg, key) + case "resourceOwnerUsername": + err = unpopulate(val, "ResourceOwnerUsername", &a.ResourceOwnerUsername) + delete(rawMsg, key) + case "supportState": + err = unpopulate(val, "SupportState", &a.SupportState) + delete(rawMsg, key) + case "tokenBodyParameters": + err = unpopulate(val, "TokenBodyParameters", &a.TokenBodyParameters) + delete(rawMsg, key) + case "tokenEndpoint": + err = unpopulate(val, "TokenEndpoint", &a.TokenEndpoint) + delete(rawMsg, key) + case "useInApiDocumentation": + err = unpopulate(val, "UseInAPIDocumentation", &a.UseInAPIDocumentation) + delete(rawMsg, key) + case "useInTestConsole": + err = unpopulate(val, "UseInTestConsole", &a.UseInTestConsole) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthorizationServerSecretsContract. +func (a AuthorizationServerSecretsContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientSecret", a.ClientSecret) + populate(objectMap, "resourceOwnerPassword", a.ResourceOwnerPassword) + populate(objectMap, "resourceOwnerUsername", a.ResourceOwnerUsername) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationServerSecretsContract. +func (a *AuthorizationServerSecretsContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientSecret": + err = unpopulate(val, "ClientSecret", &a.ClientSecret) + delete(rawMsg, key) + case "resourceOwnerPassword": + err = unpopulate(val, "ResourceOwnerPassword", &a.ResourceOwnerPassword) + delete(rawMsg, key) + case "resourceOwnerUsername": + err = unpopulate(val, "ResourceOwnerUsername", &a.ResourceOwnerUsername) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthorizationServerUpdateContract. +func (a AuthorizationServerUpdateContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationServerUpdateContract. +func (a *AuthorizationServerUpdateContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthorizationServerUpdateContractProperties. +func (a AuthorizationServerUpdateContractProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authorizationEndpoint", a.AuthorizationEndpoint) + populate(objectMap, "authorizationMethods", a.AuthorizationMethods) + populate(objectMap, "bearerTokenSendingMethods", a.BearerTokenSendingMethods) + populate(objectMap, "clientAuthenticationMethod", a.ClientAuthenticationMethod) + populate(objectMap, "clientId", a.ClientID) + populate(objectMap, "clientRegistrationEndpoint", a.ClientRegistrationEndpoint) + populate(objectMap, "clientSecret", a.ClientSecret) + populate(objectMap, "defaultScope", a.DefaultScope) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "grantTypes", a.GrantTypes) + populate(objectMap, "resourceOwnerPassword", a.ResourceOwnerPassword) + populate(objectMap, "resourceOwnerUsername", a.ResourceOwnerUsername) + populate(objectMap, "supportState", a.SupportState) + populate(objectMap, "tokenBodyParameters", a.TokenBodyParameters) + populate(objectMap, "tokenEndpoint", a.TokenEndpoint) + populate(objectMap, "useInApiDocumentation", a.UseInAPIDocumentation) + populate(objectMap, "useInTestConsole", a.UseInTestConsole) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationServerUpdateContractProperties. +func (a *AuthorizationServerUpdateContractProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizationEndpoint": + err = unpopulate(val, "AuthorizationEndpoint", &a.AuthorizationEndpoint) + delete(rawMsg, key) + case "authorizationMethods": + err = unpopulate(val, "AuthorizationMethods", &a.AuthorizationMethods) + delete(rawMsg, key) + case "bearerTokenSendingMethods": + err = unpopulate(val, "BearerTokenSendingMethods", &a.BearerTokenSendingMethods) + delete(rawMsg, key) + case "clientAuthenticationMethod": + err = unpopulate(val, "ClientAuthenticationMethod", &a.ClientAuthenticationMethod) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &a.ClientID) + delete(rawMsg, key) + case "clientRegistrationEndpoint": + err = unpopulate(val, "ClientRegistrationEndpoint", &a.ClientRegistrationEndpoint) + delete(rawMsg, key) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &a.ClientSecret) + delete(rawMsg, key) + case "defaultScope": + err = unpopulate(val, "DefaultScope", &a.DefaultScope) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "grantTypes": + err = unpopulate(val, "GrantTypes", &a.GrantTypes) + delete(rawMsg, key) + case "resourceOwnerPassword": + err = unpopulate(val, "ResourceOwnerPassword", &a.ResourceOwnerPassword) + delete(rawMsg, key) + case "resourceOwnerUsername": + err = unpopulate(val, "ResourceOwnerUsername", &a.ResourceOwnerUsername) + delete(rawMsg, key) + case "supportState": + err = unpopulate(val, "SupportState", &a.SupportState) + delete(rawMsg, key) + case "tokenBodyParameters": + err = unpopulate(val, "TokenBodyParameters", &a.TokenBodyParameters) + delete(rawMsg, key) + case "tokenEndpoint": + err = unpopulate(val, "TokenEndpoint", &a.TokenEndpoint) + delete(rawMsg, key) + case "useInApiDocumentation": + err = unpopulate(val, "UseInAPIDocumentation", &a.UseInAPIDocumentation) + delete(rawMsg, key) + case "useInTestConsole": + err = unpopulate(val, "UseInTestConsole", &a.UseInTestConsole) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendAuthorizationHeaderCredentials. +func (b BackendAuthorizationHeaderCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "parameter", b.Parameter) + populate(objectMap, "scheme", b.Scheme) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendAuthorizationHeaderCredentials. +func (b *BackendAuthorizationHeaderCredentials) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "parameter": + err = unpopulate(val, "Parameter", &b.Parameter) + delete(rawMsg, key) + case "scheme": + err = unpopulate(val, "Scheme", &b.Scheme) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendBaseParameters. +func (b BackendBaseParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "circuitBreaker", b.CircuitBreaker) + populate(objectMap, "credentials", b.Credentials) + populate(objectMap, "description", b.Description) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "proxy", b.Proxy) + populate(objectMap, "resourceId", b.ResourceID) + populate(objectMap, "tls", b.TLS) + populate(objectMap, "title", b.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendBaseParameters. +func (b *BackendBaseParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "circuitBreaker": + err = unpopulate(val, "CircuitBreaker", &b.CircuitBreaker) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &b.Credentials) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &b.Description) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "proxy": + err = unpopulate(val, "Proxy", &b.Proxy) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &b.ResourceID) + delete(rawMsg, key) + case "tls": + err = unpopulate(val, "TLS", &b.TLS) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &b.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendCircuitBreaker. +func (b BackendCircuitBreaker) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "rules", b.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendCircuitBreaker. +func (b *BackendCircuitBreaker) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "rules": + err = unpopulate(val, "Rules", &b.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendCollection. +func (b BackendCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", b.Count) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendCollection. +func (b *BackendCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "count": + err = unpopulate(val, "Count", &b.Count) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendContract. +func (b BackendContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendContract. +func (b *BackendContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendContractProperties. +func (b BackendContractProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "circuitBreaker", b.CircuitBreaker) + populate(objectMap, "credentials", b.Credentials) + populate(objectMap, "description", b.Description) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "protocol", b.Protocol) + populate(objectMap, "proxy", b.Proxy) + populate(objectMap, "resourceId", b.ResourceID) + populate(objectMap, "tls", b.TLS) + populate(objectMap, "title", b.Title) + populate(objectMap, "url", b.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendContractProperties. +func (b *BackendContractProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "circuitBreaker": + err = unpopulate(val, "CircuitBreaker", &b.CircuitBreaker) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &b.Credentials) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &b.Description) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &b.Protocol) + delete(rawMsg, key) + case "proxy": + err = unpopulate(val, "Proxy", &b.Proxy) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &b.ResourceID) + delete(rawMsg, key) + case "tls": + err = unpopulate(val, "TLS", &b.TLS) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &b.Title) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &b.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendCredentialsContract. +func (b BackendCredentialsContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authorization", b.Authorization) + populate(objectMap, "certificate", b.Certificate) + populate(objectMap, "certificateIds", b.CertificateIDs) + populate(objectMap, "header", b.Header) + populate(objectMap, "query", b.Query) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendCredentialsContract. +func (b *BackendCredentialsContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorization": + err = unpopulate(val, "Authorization", &b.Authorization) + delete(rawMsg, key) + case "certificate": + err = unpopulate(val, "Certificate", &b.Certificate) + delete(rawMsg, key) + case "certificateIds": + err = unpopulate(val, "CertificateIDs", &b.CertificateIDs) + delete(rawMsg, key) + case "header": + err = unpopulate(val, "Header", &b.Header) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &b.Query) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendProperties. +func (b BackendProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "serviceFabricCluster", b.ServiceFabricCluster) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendProperties. +func (b *BackendProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "serviceFabricCluster": + err = unpopulate(val, "ServiceFabricCluster", &b.ServiceFabricCluster) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendProxyContract. +func (b BackendProxyContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "password", b.Password) + populate(objectMap, "url", b.URL) + populate(objectMap, "username", b.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendProxyContract. +func (b *BackendProxyContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "password": + err = unpopulate(val, "Password", &b.Password) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &b.URL) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &b.Username) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendReconnectContract. +func (b BackendReconnectContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendReconnectContract. +func (b *BackendReconnectContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendReconnectProperties. +func (b BackendReconnectProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "after", b.After) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendReconnectProperties. +func (b *BackendReconnectProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "after": + err = unpopulate(val, "After", &b.After) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendServiceFabricClusterProperties. +func (b BackendServiceFabricClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientCertificateId", b.ClientCertificateID) + populate(objectMap, "clientCertificatethumbprint", b.ClientCertificatethumbprint) + populate(objectMap, "managementEndpoints", b.ManagementEndpoints) + populate(objectMap, "maxPartitionResolutionRetries", b.MaxPartitionResolutionRetries) + populate(objectMap, "serverCertificateThumbprints", b.ServerCertificateThumbprints) + populate(objectMap, "serverX509Names", b.ServerX509Names) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendServiceFabricClusterProperties. +func (b *BackendServiceFabricClusterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientCertificateId": + err = unpopulate(val, "ClientCertificateID", &b.ClientCertificateID) + delete(rawMsg, key) + case "clientCertificatethumbprint": + err = unpopulate(val, "ClientCertificatethumbprint", &b.ClientCertificatethumbprint) + delete(rawMsg, key) + case "managementEndpoints": + err = unpopulate(val, "ManagementEndpoints", &b.ManagementEndpoints) + delete(rawMsg, key) + case "maxPartitionResolutionRetries": + err = unpopulate(val, "MaxPartitionResolutionRetries", &b.MaxPartitionResolutionRetries) + delete(rawMsg, key) + case "serverCertificateThumbprints": + err = unpopulate(val, "ServerCertificateThumbprints", &b.ServerCertificateThumbprints) + delete(rawMsg, key) + case "serverX509Names": + err = unpopulate(val, "ServerX509Names", &b.ServerX509Names) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendTLSProperties. +func (b BackendTLSProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "validateCertificateChain", b.ValidateCertificateChain) + populate(objectMap, "validateCertificateName", b.ValidateCertificateName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendTLSProperties. +func (b *BackendTLSProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "validateCertificateChain": + err = unpopulate(val, "ValidateCertificateChain", &b.ValidateCertificateChain) + delete(rawMsg, key) + case "validateCertificateName": + err = unpopulate(val, "ValidateCertificateName", &b.ValidateCertificateName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendUpdateParameterProperties. +func (b BackendUpdateParameterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "circuitBreaker", b.CircuitBreaker) + populate(objectMap, "credentials", b.Credentials) + populate(objectMap, "description", b.Description) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "protocol", b.Protocol) + populate(objectMap, "proxy", b.Proxy) + populate(objectMap, "resourceId", b.ResourceID) + populate(objectMap, "tls", b.TLS) + populate(objectMap, "title", b.Title) + populate(objectMap, "url", b.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendUpdateParameterProperties. +func (b *BackendUpdateParameterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "circuitBreaker": + err = unpopulate(val, "CircuitBreaker", &b.CircuitBreaker) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &b.Credentials) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &b.Description) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &b.Protocol) + delete(rawMsg, key) + case "proxy": + err = unpopulate(val, "Proxy", &b.Proxy) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &b.ResourceID) + delete(rawMsg, key) + case "tls": + err = unpopulate(val, "TLS", &b.TLS) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &b.Title) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &b.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendUpdateParameters. +func (b BackendUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", b.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendUpdateParameters. +func (b *BackendUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BodyDiagnosticSettings. +func (b BodyDiagnosticSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bytes", b.Bytes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BodyDiagnosticSettings. +func (b *BodyDiagnosticSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", b, err) @@ -2646,5358 +3381,6610 @@ func (b *BackendServiceFabricClusterProperties) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "clientCertificateId": - err = unpopulate(val, "ClientCertificateID", &b.ClientCertificateID) + case "bytes": + err = unpopulate(val, "Bytes", &b.Bytes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheCollection. +func (c CacheCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", c.Count) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheCollection. +func (c *CacheCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "count": + err = unpopulate(val, "Count", &c.Count) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheContract. +func (c CacheContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheContract. +func (c *CacheContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheContractProperties. +func (c CacheContractProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectionString", c.ConnectionString) + populate(objectMap, "description", c.Description) + populate(objectMap, "resourceId", c.ResourceID) + populate(objectMap, "useFromLocation", c.UseFromLocation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheContractProperties. +func (c *CacheContractProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionString": + err = unpopulate(val, "ConnectionString", &c.ConnectionString) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &c.ResourceID) + delete(rawMsg, key) + case "useFromLocation": + err = unpopulate(val, "UseFromLocation", &c.UseFromLocation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheUpdateParameters. +func (c CacheUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheUpdateParameters. +func (c *CacheUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheUpdateProperties. +func (c CacheUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectionString", c.ConnectionString) + populate(objectMap, "description", c.Description) + populate(objectMap, "resourceId", c.ResourceID) + populate(objectMap, "useFromLocation", c.UseFromLocation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheUpdateProperties. +func (c *CacheUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionString": + err = unpopulate(val, "ConnectionString", &c.ConnectionString) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &c.ResourceID) + delete(rawMsg, key) + case "useFromLocation": + err = unpopulate(val, "UseFromLocation", &c.UseFromLocation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateCollection. +func (c CertificateCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", c.Count) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateCollection. +func (c *CertificateCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "count": + err = unpopulate(val, "Count", &c.Count) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateConfiguration. +func (c CertificateConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificate", c.Certificate) + populate(objectMap, "certificatePassword", c.CertificatePassword) + populate(objectMap, "encodedCertificate", c.EncodedCertificate) + populate(objectMap, "storeName", c.StoreName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateConfiguration. +func (c *CertificateConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificate": + err = unpopulate(val, "Certificate", &c.Certificate) + delete(rawMsg, key) + case "certificatePassword": + err = unpopulate(val, "CertificatePassword", &c.CertificatePassword) + delete(rawMsg, key) + case "encodedCertificate": + err = unpopulate(val, "EncodedCertificate", &c.EncodedCertificate) + delete(rawMsg, key) + case "storeName": + err = unpopulate(val, "StoreName", &c.StoreName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateContract. +func (c CertificateContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateContract. +func (c *CertificateContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateContractProperties. +func (c CertificateContractProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "expirationDate", c.ExpirationDate) + populate(objectMap, "keyVault", c.KeyVault) + populate(objectMap, "subject", c.Subject) + populate(objectMap, "thumbprint", c.Thumbprint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateContractProperties. +func (c *CertificateContractProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "expirationDate": + err = unpopulateTimeRFC3339(val, "ExpirationDate", &c.ExpirationDate) + delete(rawMsg, key) + case "keyVault": + err = unpopulate(val, "KeyVault", &c.KeyVault) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &c.Subject) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &c.Thumbprint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateCreateOrUpdateParameters. +func (c CertificateCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateCreateOrUpdateParameters. +func (c *CertificateCreateOrUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateCreateOrUpdateProperties. +func (c CertificateCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "data", c.Data) + populate(objectMap, "keyVault", c.KeyVault) + populate(objectMap, "password", c.Password) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateCreateOrUpdateProperties. +func (c *CertificateCreateOrUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "data": + err = unpopulate(val, "Data", &c.Data) + delete(rawMsg, key) + case "keyVault": + err = unpopulate(val, "KeyVault", &c.KeyVault) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &c.Password) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateInformation. +func (c CertificateInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "expiry", c.Expiry) + populate(objectMap, "subject", c.Subject) + populate(objectMap, "thumbprint", c.Thumbprint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateInformation. +func (c *CertificateInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "expiry": + err = unpopulateTimeRFC3339(val, "Expiry", &c.Expiry) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &c.Subject) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &c.Thumbprint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CircuitBreakerFailureCondition. +func (c CircuitBreakerFailureCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", c.Count) + populate(objectMap, "errorReasons", c.ErrorReasons) + populate(objectMap, "interval", c.Interval) + populate(objectMap, "percentage", c.Percentage) + populate(objectMap, "statusCodeRanges", c.StatusCodeRanges) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CircuitBreakerFailureCondition. +func (c *CircuitBreakerFailureCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "count": + err = unpopulate(val, "Count", &c.Count) + delete(rawMsg, key) + case "errorReasons": + err = unpopulate(val, "ErrorReasons", &c.ErrorReasons) + delete(rawMsg, key) + case "interval": + err = unpopulate(val, "Interval", &c.Interval) + delete(rawMsg, key) + case "percentage": + err = unpopulate(val, "Percentage", &c.Percentage) + delete(rawMsg, key) + case "statusCodeRanges": + err = unpopulate(val, "StatusCodeRanges", &c.StatusCodeRanges) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CircuitBreakerRule. +func (c CircuitBreakerRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "failureCondition", c.FailureCondition) + populate(objectMap, "name", c.Name) + populate(objectMap, "tripDuration", c.TripDuration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CircuitBreakerRule. +func (c *CircuitBreakerRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "failureCondition": + err = unpopulate(val, "FailureCondition", &c.FailureCondition) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "tripDuration": + err = unpopulate(val, "TripDuration", &c.TripDuration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClientSecretContract. +func (c ClientSecretContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientSecret", c.ClientSecret) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientSecretContract. +func (c *ClientSecretContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientSecret": + err = unpopulate(val, "ClientSecret", &c.ClientSecret) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationAPI. +func (c ConfigurationAPI) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "legacyApi", c.LegacyAPI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationAPI. +func (c *ConfigurationAPI) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "legacyApi": + err = unpopulate(val, "LegacyAPI", &c.LegacyAPI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityCheckRequest. +func (c ConnectivityCheckRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destination", c.Destination) + populate(objectMap, "preferredIPVersion", c.PreferredIPVersion) + populate(objectMap, "protocol", c.Protocol) + populate(objectMap, "protocolConfiguration", c.ProtocolConfiguration) + populate(objectMap, "source", c.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityCheckRequest. +func (c *ConnectivityCheckRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destination": + err = unpopulate(val, "Destination", &c.Destination) + delete(rawMsg, key) + case "preferredIPVersion": + err = unpopulate(val, "PreferredIPVersion", &c.PreferredIPVersion) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &c.Protocol) + delete(rawMsg, key) + case "protocolConfiguration": + err = unpopulate(val, "ProtocolConfiguration", &c.ProtocolConfiguration) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &c.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityCheckRequestDestination. +func (c ConnectivityCheckRequestDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "address", c.Address) + populate(objectMap, "port", c.Port) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityCheckRequestDestination. +func (c *ConnectivityCheckRequestDestination) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &c.Address) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &c.Port) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityCheckRequestProtocolConfiguration. +func (c ConnectivityCheckRequestProtocolConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "HTTPConfiguration", c.HTTPConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityCheckRequestProtocolConfiguration. +func (c *ConnectivityCheckRequestProtocolConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "HTTPConfiguration": + err = unpopulate(val, "HTTPConfiguration", &c.HTTPConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration. +func (c ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "headers", c.Headers) + populate(objectMap, "method", c.Method) + populate(objectMap, "validStatusCodes", c.ValidStatusCodes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration. +func (c *ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "headers": + err = unpopulate(val, "Headers", &c.Headers) + delete(rawMsg, key) + case "method": + err = unpopulate(val, "Method", &c.Method) + delete(rawMsg, key) + case "validStatusCodes": + err = unpopulate(val, "ValidStatusCodes", &c.ValidStatusCodes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityCheckRequestSource. +func (c ConnectivityCheckRequestSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "instance", c.Instance) + populate(objectMap, "region", c.Region) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityCheckRequestSource. +func (c *ConnectivityCheckRequestSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instance": + err = unpopulate(val, "Instance", &c.Instance) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &c.Region) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityCheckResponse. +func (c ConnectivityCheckResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "avgLatencyInMs", c.AvgLatencyInMs) + populate(objectMap, "connectionStatus", c.ConnectionStatus) + populate(objectMap, "hops", c.Hops) + populate(objectMap, "maxLatencyInMs", c.MaxLatencyInMs) + populate(objectMap, "minLatencyInMs", c.MinLatencyInMs) + populate(objectMap, "probesFailed", c.ProbesFailed) + populate(objectMap, "probesSent", c.ProbesSent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityCheckResponse. +func (c *ConnectivityCheckResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "avgLatencyInMs": + err = unpopulate(val, "AvgLatencyInMs", &c.AvgLatencyInMs) + delete(rawMsg, key) + case "connectionStatus": + err = unpopulate(val, "ConnectionStatus", &c.ConnectionStatus) + delete(rawMsg, key) + case "hops": + err = unpopulate(val, "Hops", &c.Hops) + delete(rawMsg, key) + case "maxLatencyInMs": + err = unpopulate(val, "MaxLatencyInMs", &c.MaxLatencyInMs) + delete(rawMsg, key) + case "minLatencyInMs": + err = unpopulate(val, "MinLatencyInMs", &c.MinLatencyInMs) + delete(rawMsg, key) + case "probesFailed": + err = unpopulate(val, "ProbesFailed", &c.ProbesFailed) + delete(rawMsg, key) + case "probesSent": + err = unpopulate(val, "ProbesSent", &c.ProbesSent) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityHop. +func (c ConnectivityHop) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "address", c.Address) + populate(objectMap, "id", c.ID) + populate(objectMap, "issues", c.Issues) + populate(objectMap, "nextHopIds", c.NextHopIDs) + populate(objectMap, "resourceId", c.ResourceID) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityHop. +func (c *ConnectivityHop) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &c.Address) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "issues": + err = unpopulate(val, "Issues", &c.Issues) + delete(rawMsg, key) + case "nextHopIds": + err = unpopulate(val, "NextHopIDs", &c.NextHopIDs) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &c.ResourceID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityIssue. +func (c ConnectivityIssue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "context", c.Context) + populate(objectMap, "origin", c.Origin) + populate(objectMap, "severity", c.Severity) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityIssue. +func (c *ConnectivityIssue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "context": + err = unpopulate(val, "Context", &c.Context) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &c.Origin) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &c.Severity) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityStatusContract. +func (c ConnectivityStatusContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", c.Error) + populate(objectMap, "isOptional", c.IsOptional) + populateTimeRFC3339(objectMap, "lastStatusChange", c.LastStatusChange) + populateTimeRFC3339(objectMap, "lastUpdated", c.LastUpdated) + populate(objectMap, "name", c.Name) + populate(objectMap, "resourceType", c.ResourceType) + populate(objectMap, "status", c.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityStatusContract. +func (c *ConnectivityStatusContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &c.Error) + delete(rawMsg, key) + case "isOptional": + err = unpopulate(val, "IsOptional", &c.IsOptional) + delete(rawMsg, key) + case "lastStatusChange": + err = unpopulateTimeRFC3339(val, "LastStatusChange", &c.LastStatusChange) + delete(rawMsg, key) + case "lastUpdated": + err = unpopulateTimeRFC3339(val, "LastUpdated", &c.LastUpdated) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &c.ResourceType) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContentItemCollection. +func (c ContentItemCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentItemCollection. +func (c *ContentItemCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContentItemContract. +func (c ContentItemContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentItemContract. +func (c *ContentItemContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContentTypeCollection. +func (c ContentTypeCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentTypeCollection. +func (c *ContentTypeCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) delete(rawMsg, key) - case "clientCertificatethumbprint": - err = unpopulate(val, "ClientCertificatethumbprint", &b.ClientCertificatethumbprint) + case "value": + err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) - case "managementEndpoints": - err = unpopulate(val, "ManagementEndpoints", &b.ManagementEndpoints) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContentTypeContract. +func (c ContentTypeContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentTypeContract. +func (c *ContentTypeContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) - case "maxPartitionResolutionRetries": - err = unpopulate(val, "MaxPartitionResolutionRetries", &b.MaxPartitionResolutionRetries) + case "name": + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "serverCertificateThumbprints": - err = unpopulate(val, "ServerCertificateThumbprints", &b.ServerCertificateThumbprints) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) - case "serverX509Names": - err = unpopulate(val, "ServerX509Names", &b.ServerX509Names) + case "type": + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BackendTLSProperties. -func (b BackendTLSProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContentTypeContractProperties. +func (c ContentTypeContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "validateCertificateChain", b.ValidateCertificateChain) - populate(objectMap, "validateCertificateName", b.ValidateCertificateName) + populate(objectMap, "description", c.Description) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populateAny(objectMap, "schema", c.Schema) + populate(objectMap, "version", c.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackendTLSProperties. -func (b *BackendTLSProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentTypeContractProperties. +func (c *ContentTypeContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "validateCertificateChain": - err = unpopulate(val, "ValidateCertificateChain", &b.ValidateCertificateChain) + case "description": + err = unpopulate(val, "Description", &c.Description) delete(rawMsg, key) - case "validateCertificateName": - err = unpopulate(val, "ValidateCertificateName", &b.ValidateCertificateName) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "schema": + err = unpopulate(val, "Schema", &c.Schema) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &c.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BackendUpdateParameterProperties. -func (b BackendUpdateParameterProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataMasking. +func (d DataMasking) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "credentials", b.Credentials) - populate(objectMap, "description", b.Description) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "protocol", b.Protocol) - populate(objectMap, "proxy", b.Proxy) - populate(objectMap, "resourceId", b.ResourceID) - populate(objectMap, "tls", b.TLS) - populate(objectMap, "title", b.Title) - populate(objectMap, "url", b.URL) + populate(objectMap, "headers", d.Headers) + populate(objectMap, "queryParams", d.QueryParams) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackendUpdateParameterProperties. -func (b *BackendUpdateParameterProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataMasking. +func (d *DataMasking) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "credentials": - err = unpopulate(val, "Credentials", &b.Credentials) + case "headers": + err = unpopulate(val, "Headers", &d.Headers) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &b.Description) + case "queryParams": + err = unpopulate(val, "QueryParams", &d.QueryParams) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataMaskingEntity. +func (d DataMaskingEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "mode", d.Mode) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataMaskingEntity. +func (d *DataMaskingEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "mode": + err = unpopulate(val, "Mode", &d.Mode) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeletedServiceContract. +func (d DeletedServiceContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedServiceContract. +func (d *DeletedServiceContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &b.Properties) + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "protocol": - err = unpopulate(val, "Protocol", &b.Protocol) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) - case "proxy": - err = unpopulate(val, "Proxy", &b.Proxy) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeletedServiceContractProperties. +func (d DeletedServiceContractProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "deletionDate", d.DeletionDate) + populateTimeRFC3339(objectMap, "scheduledPurgeDate", d.ScheduledPurgeDate) + populate(objectMap, "serviceId", d.ServiceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedServiceContractProperties. +func (d *DeletedServiceContractProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "deletionDate": + err = unpopulateTimeRFC3339(val, "DeletionDate", &d.DeletionDate) delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &b.ResourceID) + case "scheduledPurgeDate": + err = unpopulateTimeRFC3339(val, "ScheduledPurgeDate", &d.ScheduledPurgeDate) delete(rawMsg, key) - case "tls": - err = unpopulate(val, "TLS", &b.TLS) + case "serviceId": + err = unpopulate(val, "ServiceID", &d.ServiceID) delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &b.Title) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeletedServicesCollection. +func (d DeletedServicesCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedServicesCollection. +func (d *DeletedServicesCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) - case "url": - err = unpopulate(val, "URL", &b.URL) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BackendUpdateParameters. -func (b BackendUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeployConfigurationParameterProperties. +func (d DeployConfigurationParameterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", b.Properties) + populate(objectMap, "branch", d.Branch) + populate(objectMap, "force", d.Force) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackendUpdateParameters. -func (b *BackendUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeployConfigurationParameterProperties. +func (d *DeployConfigurationParameterProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &b.Properties) + case "branch": + err = unpopulate(val, "Branch", &d.Branch) + delete(rawMsg, key) + case "force": + err = unpopulate(val, "Force", &d.Force) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BodyDiagnosticSettings. -func (b BodyDiagnosticSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeployConfigurationParameters. +func (d DeployConfigurationParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "bytes", b.Bytes) + populate(objectMap, "properties", d.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BodyDiagnosticSettings. -func (b *BodyDiagnosticSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeployConfigurationParameters. +func (d *DeployConfigurationParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "bytes": - err = unpopulate(val, "Bytes", &b.Bytes) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CacheCollection. -func (c CacheCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DiagnosticCollection. +func (d DiagnosticCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", c.Count) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "count", d.Count) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CacheCollection. -func (c *CacheCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticCollection. +func (d *DiagnosticCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { case "count": - err = unpopulate(val, "Count", &c.Count) + err = unpopulate(val, "Count", &d.Count) delete(rawMsg, key) case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) + err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &c.Value) + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CacheContract. -func (c CacheContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DiagnosticContract. +func (d DiagnosticContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "type", c.Type) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CacheContract. -func (c *CacheContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticContract. +func (d *DiagnosticContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &c.ID) + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &c.Name) + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &c.Properties) + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &c.Type) + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CacheContractProperties. -func (c CacheContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DiagnosticContractProperties. +func (d DiagnosticContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "connectionString", c.ConnectionString) - populate(objectMap, "description", c.Description) - populate(objectMap, "resourceId", c.ResourceID) - populate(objectMap, "useFromLocation", c.UseFromLocation) + populate(objectMap, "alwaysLog", d.AlwaysLog) + populate(objectMap, "backend", d.Backend) + populate(objectMap, "frontend", d.Frontend) + populate(objectMap, "httpCorrelationProtocol", d.HTTPCorrelationProtocol) + populate(objectMap, "logClientIp", d.LogClientIP) + populate(objectMap, "loggerId", d.LoggerID) + populate(objectMap, "metrics", d.Metrics) + populate(objectMap, "operationNameFormat", d.OperationNameFormat) + populate(objectMap, "sampling", d.Sampling) + populate(objectMap, "verbosity", d.Verbosity) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CacheContractProperties. -func (c *CacheContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticContractProperties. +func (d *DiagnosticContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "connectionString": - err = unpopulate(val, "ConnectionString", &c.ConnectionString) + case "alwaysLog": + err = unpopulate(val, "AlwaysLog", &d.AlwaysLog) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &c.Description) + case "backend": + err = unpopulate(val, "Backend", &d.Backend) delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &c.ResourceID) + case "frontend": + err = unpopulate(val, "Frontend", &d.Frontend) delete(rawMsg, key) - case "useFromLocation": - err = unpopulate(val, "UseFromLocation", &c.UseFromLocation) + case "httpCorrelationProtocol": + err = unpopulate(val, "HTTPCorrelationProtocol", &d.HTTPCorrelationProtocol) + delete(rawMsg, key) + case "logClientIp": + err = unpopulate(val, "LogClientIP", &d.LogClientIP) + delete(rawMsg, key) + case "loggerId": + err = unpopulate(val, "LoggerID", &d.LoggerID) + delete(rawMsg, key) + case "metrics": + err = unpopulate(val, "Metrics", &d.Metrics) + delete(rawMsg, key) + case "operationNameFormat": + err = unpopulate(val, "OperationNameFormat", &d.OperationNameFormat) + delete(rawMsg, key) + case "sampling": + err = unpopulate(val, "Sampling", &d.Sampling) + delete(rawMsg, key) + case "verbosity": + err = unpopulate(val, "Verbosity", &d.Verbosity) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CacheUpdateParameters. -func (c CacheUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DocumentationCollection. +func (d DocumentationCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", c.Properties) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CacheUpdateParameters. -func (c *CacheUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DocumentationCollection. +func (d *DocumentationCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CacheUpdateProperties. -func (c CacheUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DocumentationContract. +func (d DocumentationContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "connectionString", c.ConnectionString) - populate(objectMap, "description", c.Description) - populate(objectMap, "resourceId", c.ResourceID) - populate(objectMap, "useFromLocation", c.UseFromLocation) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CacheUpdateProperties. -func (c *CacheUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DocumentationContract. +func (d *DocumentationContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "connectionString": - err = unpopulate(val, "ConnectionString", &c.ConnectionString) + case "id": + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &c.Description) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &c.ResourceID) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "useFromLocation": - err = unpopulate(val, "UseFromLocation", &c.UseFromLocation) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CertificateCollection. -func (c CertificateCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DocumentationContractProperties. +func (d DocumentationContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", c.Count) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "content", d.Content) + populate(objectMap, "title", d.Title) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateCollection. -func (c *CertificateCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DocumentationContractProperties. +func (d *DocumentationContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &c.Count) + case "content": + err = unpopulate(val, "Content", &d.Content) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) + case "title": + err = unpopulate(val, "Title", &d.Title) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DocumentationUpdateContract. +func (d DocumentationUpdateContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", d.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DocumentationUpdateContract. +func (d *DocumentationUpdateContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CertificateConfiguration. -func (c CertificateConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EmailTemplateCollection. +func (e EmailTemplateCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "certificate", c.Certificate) - populate(objectMap, "certificatePassword", c.CertificatePassword) - populate(objectMap, "encodedCertificate", c.EncodedCertificate) - populate(objectMap, "storeName", c.StoreName) + populate(objectMap, "count", e.Count) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateConfiguration. -func (c *CertificateConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailTemplateCollection. +func (e *EmailTemplateCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "certificate": - err = unpopulate(val, "Certificate", &c.Certificate) - delete(rawMsg, key) - case "certificatePassword": - err = unpopulate(val, "CertificatePassword", &c.CertificatePassword) + case "count": + err = unpopulate(val, "Count", &e.Count) delete(rawMsg, key) - case "encodedCertificate": - err = unpopulate(val, "EncodedCertificate", &c.EncodedCertificate) + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) delete(rawMsg, key) - case "storeName": - err = unpopulate(val, "StoreName", &c.StoreName) + case "value": + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CertificateContract. -func (c CertificateContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EmailTemplateContract. +func (e EmailTemplateContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "type", c.Type) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateContract. -func (c *CertificateContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailTemplateContract. +func (e *EmailTemplateContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &c.ID) + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &c.Name) + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &c.Properties) + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &c.Type) + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CertificateContractProperties. -func (c CertificateContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EmailTemplateContractProperties. +func (e EmailTemplateContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "expirationDate", c.ExpirationDate) - populate(objectMap, "keyVault", c.KeyVault) - populate(objectMap, "subject", c.Subject) - populate(objectMap, "thumbprint", c.Thumbprint) + populate(objectMap, "body", e.Body) + populate(objectMap, "description", e.Description) + populate(objectMap, "isDefault", e.IsDefault) + populate(objectMap, "parameters", e.Parameters) + populate(objectMap, "subject", e.Subject) + populate(objectMap, "title", e.Title) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateContractProperties. -func (c *CertificateContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailTemplateContractProperties. +func (e *EmailTemplateContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "expirationDate": - err = unpopulateTimeRFC3339(val, "ExpirationDate", &c.ExpirationDate) + case "body": + err = unpopulate(val, "Body", &e.Body) delete(rawMsg, key) - case "keyVault": - err = unpopulate(val, "KeyVault", &c.KeyVault) + case "description": + err = unpopulate(val, "Description", &e.Description) + delete(rawMsg, key) + case "isDefault": + err = unpopulate(val, "IsDefault", &e.IsDefault) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &e.Parameters) delete(rawMsg, key) case "subject": - err = unpopulate(val, "Subject", &c.Subject) + err = unpopulate(val, "Subject", &e.Subject) delete(rawMsg, key) - case "thumbprint": - err = unpopulate(val, "Thumbprint", &c.Thumbprint) + case "title": + err = unpopulate(val, "Title", &e.Title) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CertificateCreateOrUpdateParameters. -func (c CertificateCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EmailTemplateParametersContractProperties. +func (e EmailTemplateParametersContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", c.Properties) + populate(objectMap, "description", e.Description) + populate(objectMap, "name", e.Name) + populate(objectMap, "title", e.Title) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateCreateOrUpdateParameters. -func (c *CertificateCreateOrUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailTemplateParametersContractProperties. +func (e *EmailTemplateParametersContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "description": + err = unpopulate(val, "Description", &e.Description) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &e.Title) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CertificateCreateOrUpdateProperties. -func (c CertificateCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EmailTemplateUpdateParameterProperties. +func (e EmailTemplateUpdateParameterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "data", c.Data) - populate(objectMap, "keyVault", c.KeyVault) - populate(objectMap, "password", c.Password) + populate(objectMap, "body", e.Body) + populate(objectMap, "description", e.Description) + populate(objectMap, "parameters", e.Parameters) + populate(objectMap, "subject", e.Subject) + populate(objectMap, "title", e.Title) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateCreateOrUpdateProperties. -func (c *CertificateCreateOrUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailTemplateUpdateParameterProperties. +func (e *EmailTemplateUpdateParameterProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "data": - err = unpopulate(val, "Data", &c.Data) + case "body": + err = unpopulate(val, "Body", &e.Body) delete(rawMsg, key) - case "keyVault": - err = unpopulate(val, "KeyVault", &c.KeyVault) + case "description": + err = unpopulate(val, "Description", &e.Description) delete(rawMsg, key) - case "password": - err = unpopulate(val, "Password", &c.Password) + case "parameters": + err = unpopulate(val, "Parameters", &e.Parameters) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &e.Subject) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &e.Title) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CertificateInformation. -func (c CertificateInformation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EmailTemplateUpdateParameters. +func (e EmailTemplateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "expiry", c.Expiry) - populate(objectMap, "subject", c.Subject) - populate(objectMap, "thumbprint", c.Thumbprint) + populate(objectMap, "properties", e.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateInformation. -func (c *CertificateInformation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailTemplateUpdateParameters. +func (e *EmailTemplateUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "expiry": - err = unpopulateTimeRFC3339(val, "Expiry", &c.Expiry) - delete(rawMsg, key) - case "subject": - err = unpopulate(val, "Subject", &c.Subject) - delete(rawMsg, key) - case "thumbprint": - err = unpopulate(val, "Thumbprint", &c.Thumbprint) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientSecretContract. -func (c ClientSecretContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EndpointDependency. +func (e EndpointDependency) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientSecret", c.ClientSecret) + populate(objectMap, "domainName", e.DomainName) + populate(objectMap, "endpointDetails", e.EndpointDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientSecretContract. -func (c *ClientSecretContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDependency. +func (e *EndpointDependency) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "clientSecret": - err = unpopulate(val, "ClientSecret", &c.ClientSecret) + case "domainName": + err = unpopulate(val, "DomainName", &e.DomainName) + delete(rawMsg, key) + case "endpointDetails": + err = unpopulate(val, "EndpointDetails", &e.EndpointDetails) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectivityCheckRequest. -func (c ConnectivityCheckRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EndpointDetail. +func (e EndpointDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "destination", c.Destination) - populate(objectMap, "preferredIPVersion", c.PreferredIPVersion) - populate(objectMap, "protocol", c.Protocol) - populate(objectMap, "protocolConfiguration", c.ProtocolConfiguration) - populate(objectMap, "source", c.Source) + populate(objectMap, "port", e.Port) + populate(objectMap, "region", e.Region) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityCheckRequest. -func (c *ConnectivityCheckRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDetail. +func (e *EndpointDetail) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "destination": - err = unpopulate(val, "Destination", &c.Destination) - delete(rawMsg, key) - case "preferredIPVersion": - err = unpopulate(val, "PreferredIPVersion", &c.PreferredIPVersion) - delete(rawMsg, key) - case "protocol": - err = unpopulate(val, "Protocol", &c.Protocol) - delete(rawMsg, key) - case "protocolConfiguration": - err = unpopulate(val, "ProtocolConfiguration", &c.ProtocolConfiguration) + case "port": + err = unpopulate(val, "Port", &e.Port) delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &c.Source) + case "region": + err = unpopulate(val, "Region", &e.Region) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } - -// MarshalJSON implements the json.Marshaller interface for type ConnectivityCheckRequestDestination. -func (c ConnectivityCheckRequestDestination) MarshalJSON() ([]byte, error) { + +// MarshalJSON implements the json.Marshaller interface for type ErrorFieldContract. +func (e ErrorFieldContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "address", c.Address) - populate(objectMap, "port", c.Port) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityCheckRequestDestination. -func (c *ConnectivityCheckRequestDestination) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorFieldContract. +func (e *ErrorFieldContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "address": - err = unpopulate(val, "Address", &c.Address) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "port": - err = unpopulate(val, "Port", &c.Port) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectivityCheckRequestProtocolConfiguration. -func (c ConnectivityCheckRequestProtocolConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "HTTPConfiguration", c.HTTPConfiguration) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityCheckRequestProtocolConfiguration. -func (c *ConnectivityCheckRequestProtocolConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "HTTPConfiguration": - err = unpopulate(val, "HTTPConfiguration", &c.HTTPConfiguration) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration. -func (c ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseBody. +func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "headers", c.Headers) - populate(objectMap, "method", c.Method) - populate(objectMap, "validStatusCodes", c.ValidStatusCodes) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration. -func (c *ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseBody. +func (e *ErrorResponseBody) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "headers": - err = unpopulate(val, "Headers", &c.Headers) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "method": - err = unpopulate(val, "Method", &c.Method) + case "details": + err = unpopulate(val, "Details", &e.Details) delete(rawMsg, key) - case "validStatusCodes": - err = unpopulate(val, "ValidStatusCodes", &c.ValidStatusCodes) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectivityCheckRequestSource. -func (c ConnectivityCheckRequestSource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FailureStatusCodeRange. +func (f FailureStatusCodeRange) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "instance", c.Instance) - populate(objectMap, "region", c.Region) + populate(objectMap, "max", f.Max) + populate(objectMap, "min", f.Min) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityCheckRequestSource. -func (c *ConnectivityCheckRequestSource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FailureStatusCodeRange. +func (f *FailureStatusCodeRange) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } for key, val := range rawMsg { var err error switch key { - case "instance": - err = unpopulate(val, "Instance", &c.Instance) + case "max": + err = unpopulate(val, "Max", &f.Max) delete(rawMsg, key) - case "region": - err = unpopulate(val, "Region", &c.Region) + case "min": + err = unpopulate(val, "Min", &f.Min) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectivityCheckResponse. -func (c ConnectivityCheckResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayCertificateAuthorityCollection. +func (g GatewayCertificateAuthorityCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "avgLatencyInMs", c.AvgLatencyInMs) - populate(objectMap, "connectionStatus", c.ConnectionStatus) - populate(objectMap, "hops", c.Hops) - populate(objectMap, "maxLatencyInMs", c.MaxLatencyInMs) - populate(objectMap, "minLatencyInMs", c.MinLatencyInMs) - populate(objectMap, "probesFailed", c.ProbesFailed) - populate(objectMap, "probesSent", c.ProbesSent) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityCheckResponse. -func (c *ConnectivityCheckResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayCertificateAuthorityCollection. +func (g *GatewayCertificateAuthorityCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "avgLatencyInMs": - err = unpopulate(val, "AvgLatencyInMs", &c.AvgLatencyInMs) - delete(rawMsg, key) - case "connectionStatus": - err = unpopulate(val, "ConnectionStatus", &c.ConnectionStatus) - delete(rawMsg, key) - case "hops": - err = unpopulate(val, "Hops", &c.Hops) - delete(rawMsg, key) - case "maxLatencyInMs": - err = unpopulate(val, "MaxLatencyInMs", &c.MaxLatencyInMs) - delete(rawMsg, key) - case "minLatencyInMs": - err = unpopulate(val, "MinLatencyInMs", &c.MinLatencyInMs) - delete(rawMsg, key) - case "probesFailed": - err = unpopulate(val, "ProbesFailed", &c.ProbesFailed) + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) delete(rawMsg, key) - case "probesSent": - err = unpopulate(val, "ProbesSent", &c.ProbesSent) + case "value": + err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectivityHop. -func (c ConnectivityHop) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayCertificateAuthorityContract. +func (g GatewayCertificateAuthorityContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "address", c.Address) - populate(objectMap, "id", c.ID) - populate(objectMap, "issues", c.Issues) - populate(objectMap, "nextHopIds", c.NextHopIDs) - populate(objectMap, "resourceId", c.ResourceID) - populate(objectMap, "type", c.Type) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityHop. -func (c *ConnectivityHop) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayCertificateAuthorityContract. +func (g *GatewayCertificateAuthorityContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "address": - err = unpopulate(val, "Address", &c.Address) - delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "issues": - err = unpopulate(val, "Issues", &c.Issues) + err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) - case "nextHopIds": - err = unpopulate(val, "NextHopIDs", &c.NextHopIDs) + case "name": + err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &c.ResourceID) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &c.Type) + err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectivityIssue. -func (c ConnectivityIssue) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayCertificateAuthorityContractProperties. +func (g GatewayCertificateAuthorityContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "context", c.Context) - populate(objectMap, "origin", c.Origin) - populate(objectMap, "severity", c.Severity) - populate(objectMap, "type", c.Type) + populate(objectMap, "isTrusted", g.IsTrusted) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityIssue. -func (c *ConnectivityIssue) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayCertificateAuthorityContractProperties. +func (g *GatewayCertificateAuthorityContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "context": - err = unpopulate(val, "Context", &c.Context) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &c.Origin) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &c.Severity) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "isTrusted": + err = unpopulate(val, "IsTrusted", &g.IsTrusted) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectivityStatusContract. -func (c ConnectivityStatusContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayCollection. +func (g GatewayCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", c.Error) - populate(objectMap, "isOptional", c.IsOptional) - populateTimeRFC3339(objectMap, "lastStatusChange", c.LastStatusChange) - populateTimeRFC3339(objectMap, "lastUpdated", c.LastUpdated) - populate(objectMap, "name", c.Name) - populate(objectMap, "resourceType", c.ResourceType) - populate(objectMap, "status", c.Status) + populate(objectMap, "count", g.Count) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityStatusContract. -func (c *ConnectivityStatusContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayCollection. +func (g *GatewayCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &c.Error) + case "count": + err = unpopulate(val, "Count", &g.Count) delete(rawMsg, key) - case "isOptional": - err = unpopulate(val, "IsOptional", &c.IsOptional) + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) delete(rawMsg, key) - case "lastStatusChange": - err = unpopulateTimeRFC3339(val, "LastStatusChange", &c.LastStatusChange) + case "value": + err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) - case "lastUpdated": - err = unpopulateTimeRFC3339(val, "LastUpdated", &c.LastUpdated) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GatewayContract. +func (g GatewayContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayContract. +func (g *GatewayContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &c.Name) + err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) - case "resourceType": - err = unpopulate(val, "ResourceType", &c.ResourceType) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &c.Status) + case "type": + err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ContentItemCollection. -func (c ContentItemCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayContractProperties. +func (g GatewayContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "description", g.Description) + populate(objectMap, "locationData", g.LocationData) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentItemCollection. -func (c *ContentItemCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayContractProperties. +func (g *GatewayContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) + case "description": + err = unpopulate(val, "Description", &g.Description) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) + case "locationData": + err = unpopulate(val, "LocationData", &g.LocationData) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ContentItemContract. -func (c ContentItemContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayDebugCredentialsContract. +func (g GatewayDebugCredentialsContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "type", c.Type) + populate(objectMap, "token", g.Token) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentItemContract. -func (c *ContentItemContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayDebugCredentialsContract. +func (g *GatewayDebugCredentialsContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "token": + err = unpopulate(val, "Token", &g.Token) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ContentTypeCollection. -func (c ContentTypeCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayHostnameConfigurationCollection. +func (g GatewayHostnameConfigurationCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentTypeCollection. -func (c *ContentTypeCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayHostnameConfigurationCollection. +func (g *GatewayHostnameConfigurationCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) + err = unpopulate(val, "NextLink", &g.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &c.Value) + err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ContentTypeContract. -func (c ContentTypeContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayHostnameConfigurationContract. +func (g GatewayHostnameConfigurationContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "type", c.Type) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentTypeContract. -func (c *ContentTypeContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayHostnameConfigurationContract. +func (g *GatewayHostnameConfigurationContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &c.ID) + err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &c.Name) + err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &c.Properties) + err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &c.Type) + err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ContentTypeContractProperties. -func (c ContentTypeContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayHostnameConfigurationContractProperties. +func (g GatewayHostnameConfigurationContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", c.Description) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populateAny(objectMap, "schema", c.Schema) - populate(objectMap, "version", c.Version) + populate(objectMap, "certificateId", g.CertificateID) + populate(objectMap, "http2Enabled", g.HTTP2Enabled) + populate(objectMap, "hostname", g.Hostname) + populate(objectMap, "negotiateClientCertificate", g.NegotiateClientCertificate) + populate(objectMap, "tls10Enabled", g.Tls10Enabled) + populate(objectMap, "tls11Enabled", g.Tls11Enabled) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContentTypeContractProperties. -func (c *ContentTypeContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayHostnameConfigurationContractProperties. +func (g *GatewayHostnameConfigurationContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &c.Description) + case "certificateId": + err = unpopulate(val, "CertificateID", &g.CertificateID) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &c.ID) + case "http2Enabled": + err = unpopulate(val, "HTTP2Enabled", &g.HTTP2Enabled) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) + case "hostname": + err = unpopulate(val, "Hostname", &g.Hostname) delete(rawMsg, key) - case "schema": - err = unpopulate(val, "Schema", &c.Schema) + case "negotiateClientCertificate": + err = unpopulate(val, "NegotiateClientCertificate", &g.NegotiateClientCertificate) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &c.Version) + case "tls10Enabled": + err = unpopulate(val, "Tls10Enabled", &g.Tls10Enabled) + delete(rawMsg, key) + case "tls11Enabled": + err = unpopulate(val, "Tls11Enabled", &g.Tls11Enabled) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DataMasking. -func (d DataMasking) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayKeyRegenerationRequestContract. +func (g GatewayKeyRegenerationRequestContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "headers", d.Headers) - populate(objectMap, "queryParams", d.QueryParams) + populate(objectMap, "keyType", g.KeyType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataMasking. -func (d *DataMasking) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayKeyRegenerationRequestContract. +func (g *GatewayKeyRegenerationRequestContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "headers": - err = unpopulate(val, "Headers", &d.Headers) - delete(rawMsg, key) - case "queryParams": - err = unpopulate(val, "QueryParams", &d.QueryParams) + case "keyType": + err = unpopulate(val, "KeyType", &g.KeyType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DataMaskingEntity. -func (d DataMaskingEntity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayKeysContract. +func (g GatewayKeysContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "mode", d.Mode) - populate(objectMap, "value", d.Value) + populate(objectMap, "primary", g.Primary) + populate(objectMap, "secondary", g.Secondary) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataMaskingEntity. -func (d *DataMaskingEntity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayKeysContract. +func (g *GatewayKeysContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "mode": - err = unpopulate(val, "Mode", &d.Mode) + case "primary": + err = unpopulate(val, "Primary", &g.Primary) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) + case "secondary": + err = unpopulate(val, "Secondary", &g.Secondary) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DeletedServiceContract. -func (d DeletedServiceContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayListDebugCredentialsContract. +func (g GatewayListDebugCredentialsContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "type", d.Type) + populate(objectMap, "apiId", g.APIID) + populate(objectMap, "credentialsExpireAfter", g.CredentialsExpireAfter) + populate(objectMap, "purposes", g.Purposes) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedServiceContract. -func (d *DeletedServiceContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayListDebugCredentialsContract. +func (g *GatewayListDebugCredentialsContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) + case "apiId": + err = unpopulate(val, "APIID", &g.APIID) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + case "credentialsExpireAfter": + err = unpopulate(val, "CredentialsExpireAfter", &g.CredentialsExpireAfter) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "purposes": + err = unpopulate(val, "Purposes", &g.Purposes) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DeletedServiceContractProperties. -func (d DeletedServiceContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayListTraceContract. +func (g GatewayListTraceContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "deletionDate", d.DeletionDate) - populateTimeRFC3339(objectMap, "scheduledPurgeDate", d.ScheduledPurgeDate) - populate(objectMap, "serviceId", d.ServiceID) + populate(objectMap, "traceId", g.TraceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedServiceContractProperties. -func (d *DeletedServiceContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayListTraceContract. +func (g *GatewayListTraceContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "deletionDate": - err = unpopulateTimeRFC3339(val, "DeletionDate", &d.DeletionDate) - delete(rawMsg, key) - case "scheduledPurgeDate": - err = unpopulateTimeRFC3339(val, "ScheduledPurgeDate", &d.ScheduledPurgeDate) - delete(rawMsg, key) - case "serviceId": - err = unpopulate(val, "ServiceID", &d.ServiceID) + case "traceId": + err = unpopulate(val, "TraceID", &g.TraceID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DeletedServicesCollection. -func (d DeletedServicesCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayTokenContract. +func (g GatewayTokenContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedServicesCollection. -func (d *DeletedServicesCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayTokenContract. +func (g *GatewayTokenContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &d.Value) + err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DeployConfigurationParameterProperties. -func (d DeployConfigurationParameterProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GatewayTokenRequestContract. +func (g GatewayTokenRequestContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "branch", d.Branch) - populate(objectMap, "force", d.Force) + populateTimeRFC3339(objectMap, "expiry", g.Expiry) + populate(objectMap, "keyType", g.KeyType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeployConfigurationParameterProperties. -func (d *DeployConfigurationParameterProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayTokenRequestContract. +func (g *GatewayTokenRequestContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "branch": - err = unpopulate(val, "Branch", &d.Branch) + case "expiry": + err = unpopulateTimeRFC3339(val, "Expiry", &g.Expiry) delete(rawMsg, key) - case "force": - err = unpopulate(val, "Force", &d.Force) + case "keyType": + err = unpopulate(val, "KeyType", &g.KeyType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DeployConfigurationParameters. -func (d DeployConfigurationParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GenerateSsoURLResult. +func (g GenerateSsoURLResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", d.Properties) + populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeployConfigurationParameters. -func (d *DeployConfigurationParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateSsoURLResult. +func (g *GenerateSsoURLResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + case "value": + err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DiagnosticCollection. -func (d DiagnosticCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GlobalSchemaCollection. +func (g GlobalSchemaCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", d.Count) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "count", g.Count) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticCollection. -func (d *DiagnosticCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalSchemaCollection. +func (g *GlobalSchemaCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "count": - err = unpopulate(val, "Count", &d.Count) + err = unpopulate(val, "Count", &g.Count) delete(rawMsg, key) case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) + err = unpopulate(val, "NextLink", &g.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &d.Value) + err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DiagnosticContract. -func (d DiagnosticContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GlobalSchemaContract. +func (g GlobalSchemaContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "type", d.Type) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticContract. -func (d *DiagnosticContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalSchemaContract. +func (g *GlobalSchemaContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &d.ID) + err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &d.Name) + err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &d.Properties) + err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &d.Type) + err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DiagnosticContractProperties. -func (d DiagnosticContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GlobalSchemaContractProperties. +func (g GlobalSchemaContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "alwaysLog", d.AlwaysLog) - populate(objectMap, "backend", d.Backend) - populate(objectMap, "frontend", d.Frontend) - populate(objectMap, "httpCorrelationProtocol", d.HTTPCorrelationProtocol) - populate(objectMap, "logClientIp", d.LogClientIP) - populate(objectMap, "loggerId", d.LoggerID) - populate(objectMap, "operationNameFormat", d.OperationNameFormat) - populate(objectMap, "sampling", d.Sampling) - populate(objectMap, "verbosity", d.Verbosity) + populate(objectMap, "description", g.Description) + populateAny(objectMap, "document", g.Document) + populate(objectMap, "schemaType", g.SchemaType) + populateAny(objectMap, "value", g.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticContractProperties. -func (d *DiagnosticContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalSchemaContractProperties. +func (g *GlobalSchemaContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "alwaysLog": - err = unpopulate(val, "AlwaysLog", &d.AlwaysLog) - delete(rawMsg, key) - case "backend": - err = unpopulate(val, "Backend", &d.Backend) - delete(rawMsg, key) - case "frontend": - err = unpopulate(val, "Frontend", &d.Frontend) - delete(rawMsg, key) - case "httpCorrelationProtocol": - err = unpopulate(val, "HTTPCorrelationProtocol", &d.HTTPCorrelationProtocol) - delete(rawMsg, key) - case "logClientIp": - err = unpopulate(val, "LogClientIP", &d.LogClientIP) - delete(rawMsg, key) - case "loggerId": - err = unpopulate(val, "LoggerID", &d.LoggerID) + case "description": + err = unpopulate(val, "Description", &g.Description) delete(rawMsg, key) - case "operationNameFormat": - err = unpopulate(val, "OperationNameFormat", &d.OperationNameFormat) + case "document": + err = unpopulate(val, "Document", &g.Document) delete(rawMsg, key) - case "sampling": - err = unpopulate(val, "Sampling", &d.Sampling) + case "schemaType": + err = unpopulate(val, "SchemaType", &g.SchemaType) delete(rawMsg, key) - case "verbosity": - err = unpopulate(val, "Verbosity", &d.Verbosity) + case "value": + err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailTemplateCollection. -func (e EmailTemplateCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GroupCollection. +func (g GroupCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", e.Count) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) + populate(objectMap, "count", g.Count) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailTemplateCollection. -func (e *EmailTemplateCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupCollection. +func (g *GroupCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "count": - err = unpopulate(val, "Count", &e.Count) + err = unpopulate(val, "Count", &g.Count) delete(rawMsg, key) case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) + err = unpopulate(val, "NextLink", &g.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &e.Value) + err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailTemplateContract. -func (e EmailTemplateContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GroupContract. +func (g GroupContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "type", e.Type) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailTemplateContract. -func (e *EmailTemplateContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupContract. +func (g *GroupContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &e.ID) + err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &e.Name) + err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &e.Properties) + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GroupContractProperties. +func (g GroupContractProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "builtIn", g.BuiltIn) + populate(objectMap, "description", g.Description) + populate(objectMap, "displayName", g.DisplayName) + populate(objectMap, "externalId", g.ExternalID) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupContractProperties. +func (g *GroupContractProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "builtIn": + err = unpopulate(val, "BuiltIn", &g.BuiltIn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &g.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &g.DisplayName) + delete(rawMsg, key) + case "externalId": + err = unpopulate(val, "ExternalID", &g.ExternalID) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &e.Type) + err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailTemplateContractProperties. -func (e EmailTemplateContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GroupCreateParameters. +func (g GroupCreateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "body", e.Body) - populate(objectMap, "description", e.Description) - populate(objectMap, "isDefault", e.IsDefault) - populate(objectMap, "parameters", e.Parameters) - populate(objectMap, "subject", e.Subject) - populate(objectMap, "title", e.Title) + populate(objectMap, "properties", g.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailTemplateContractProperties. -func (e *EmailTemplateContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupCreateParameters. +func (g *GroupCreateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "body": - err = unpopulate(val, "Body", &e.Body) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &e.Description) - delete(rawMsg, key) - case "isDefault": - err = unpopulate(val, "IsDefault", &e.IsDefault) - delete(rawMsg, key) - case "parameters": - err = unpopulate(val, "Parameters", &e.Parameters) - delete(rawMsg, key) - case "subject": - err = unpopulate(val, "Subject", &e.Subject) - delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &e.Title) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailTemplateParametersContractProperties. -func (e EmailTemplateParametersContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GroupCreateParametersProperties. +func (g GroupCreateParametersProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", e.Description) - populate(objectMap, "name", e.Name) - populate(objectMap, "title", e.Title) + populate(objectMap, "description", g.Description) + populate(objectMap, "displayName", g.DisplayName) + populate(objectMap, "externalId", g.ExternalID) + populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailTemplateParametersContractProperties. -func (e *EmailTemplateParametersContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupCreateParametersProperties. +func (g *GroupCreateParametersProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "description": - err = unpopulate(val, "Description", &e.Description) + err = unpopulate(val, "Description", &g.Description) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) + case "displayName": + err = unpopulate(val, "DisplayName", &g.DisplayName) delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &e.Title) + case "externalId": + err = unpopulate(val, "ExternalID", &g.ExternalID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailTemplateUpdateParameterProperties. -func (e EmailTemplateUpdateParameterProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GroupUpdateParameters. +func (g GroupUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "body", e.Body) - populate(objectMap, "description", e.Description) - populate(objectMap, "parameters", e.Parameters) - populate(objectMap, "subject", e.Subject) - populate(objectMap, "title", e.Title) + populate(objectMap, "properties", g.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailTemplateUpdateParameterProperties. -func (e *EmailTemplateUpdateParameterProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupUpdateParameters. +func (g *GroupUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "body": - err = unpopulate(val, "Body", &e.Body) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &e.Description) - delete(rawMsg, key) - case "parameters": - err = unpopulate(val, "Parameters", &e.Parameters) - delete(rawMsg, key) - case "subject": - err = unpopulate(val, "Subject", &e.Subject) - delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &e.Title) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailTemplateUpdateParameters. -func (e EmailTemplateUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GroupUpdateParametersProperties. +func (g GroupUpdateParametersProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", e.Properties) + populate(objectMap, "description", g.Description) + populate(objectMap, "displayName", g.DisplayName) + populate(objectMap, "externalId", g.ExternalID) + populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailTemplateUpdateParameters. -func (e *EmailTemplateUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupUpdateParametersProperties. +func (g *GroupUpdateParametersProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &e.Properties) + case "description": + err = unpopulate(val, "Description", &g.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &g.DisplayName) + delete(rawMsg, key) + case "externalId": + err = unpopulate(val, "ExternalID", &g.ExternalID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EndpointDependency. -func (e EndpointDependency) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HTTPHeader. +func (h HTTPHeader) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "domainName", e.DomainName) - populate(objectMap, "endpointDetails", e.EndpointDetails) + populate(objectMap, "name", h.Name) + populate(objectMap, "value", h.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDependency. -func (e *EndpointDependency) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPHeader. +func (h *HTTPHeader) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } for key, val := range rawMsg { var err error switch key { - case "domainName": - err = unpopulate(val, "DomainName", &e.DomainName) + case "name": + err = unpopulate(val, "Name", &h.Name) delete(rawMsg, key) - case "endpointDetails": - err = unpopulate(val, "EndpointDetails", &e.EndpointDetails) + case "value": + err = unpopulate(val, "Value", &h.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EndpointDetail. -func (e EndpointDetail) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HTTPMessageDiagnostic. +func (h HTTPMessageDiagnostic) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "port", e.Port) - populate(objectMap, "region", e.Region) + populate(objectMap, "body", h.Body) + populate(objectMap, "dataMasking", h.DataMasking) + populate(objectMap, "headers", h.Headers) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDetail. -func (e *EndpointDetail) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPMessageDiagnostic. +func (h *HTTPMessageDiagnostic) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } for key, val := range rawMsg { var err error switch key { - case "port": - err = unpopulate(val, "Port", &e.Port) + case "body": + err = unpopulate(val, "Body", &h.Body) delete(rawMsg, key) - case "region": - err = unpopulate(val, "Region", &e.Region) + case "dataMasking": + err = unpopulate(val, "DataMasking", &h.DataMasking) + delete(rawMsg, key) + case "headers": + err = unpopulate(val, "Headers", &h.Headers) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorFieldContract. -func (e ErrorFieldContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HostnameConfiguration. +func (h HostnameConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) + populate(objectMap, "certificate", h.Certificate) + populate(objectMap, "certificatePassword", h.CertificatePassword) + populate(objectMap, "certificateSource", h.CertificateSource) + populate(objectMap, "certificateStatus", h.CertificateStatus) + populate(objectMap, "defaultSslBinding", h.DefaultSSLBinding) + populate(objectMap, "encodedCertificate", h.EncodedCertificate) + populate(objectMap, "hostName", h.HostName) + populate(objectMap, "identityClientId", h.IdentityClientID) + populate(objectMap, "keyVaultId", h.KeyVaultID) + populate(objectMap, "negotiateClientCertificate", h.NegotiateClientCertificate) + populate(objectMap, "type", h.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorFieldContract. -func (e *ErrorFieldContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HostnameConfiguration. +func (h *HostnameConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) + case "certificate": + err = unpopulate(val, "Certificate", &h.Certificate) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "certificatePassword": + err = unpopulate(val, "CertificatePassword", &h.CertificatePassword) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) + case "certificateSource": + err = unpopulate(val, "CertificateSource", &h.CertificateSource) + delete(rawMsg, key) + case "certificateStatus": + err = unpopulate(val, "CertificateStatus", &h.CertificateStatus) + delete(rawMsg, key) + case "defaultSslBinding": + err = unpopulate(val, "DefaultSSLBinding", &h.DefaultSSLBinding) + delete(rawMsg, key) + case "encodedCertificate": + err = unpopulate(val, "EncodedCertificate", &h.EncodedCertificate) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &h.HostName) + delete(rawMsg, key) + case "identityClientId": + err = unpopulate(val, "IdentityClientID", &h.IdentityClientID) + delete(rawMsg, key) + case "keyVaultId": + err = unpopulate(val, "KeyVaultID", &h.KeyVaultID) + delete(rawMsg, key) + case "negotiateClientCertificate": + err = unpopulate(val, "NegotiateClientCertificate", &h.NegotiateClientCertificate) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IdentityProviderBaseParameters. +func (i IdentityProviderBaseParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + populate(objectMap, "allowedTenants", i.AllowedTenants) + populate(objectMap, "authority", i.Authority) + populate(objectMap, "clientLibrary", i.ClientLibrary) + populate(objectMap, "passwordResetPolicyName", i.PasswordResetPolicyName) + populate(objectMap, "profileEditingPolicyName", i.ProfileEditingPolicyName) + populate(objectMap, "signinPolicyName", i.SigninPolicyName) + populate(objectMap, "signinTenant", i.SigninTenant) + populate(objectMap, "signupPolicyName", i.SignupPolicyName) + populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderBaseParameters. +func (i *IdentityProviderBaseParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "allowedTenants": + err = unpopulate(val, "AllowedTenants", &i.AllowedTenants) + delete(rawMsg, key) + case "authority": + err = unpopulate(val, "Authority", &i.Authority) + delete(rawMsg, key) + case "clientLibrary": + err = unpopulate(val, "ClientLibrary", &i.ClientLibrary) + delete(rawMsg, key) + case "passwordResetPolicyName": + err = unpopulate(val, "PasswordResetPolicyName", &i.PasswordResetPolicyName) + delete(rawMsg, key) + case "profileEditingPolicyName": + err = unpopulate(val, "ProfileEditingPolicyName", &i.ProfileEditingPolicyName) + delete(rawMsg, key) + case "signinPolicyName": + err = unpopulate(val, "SigninPolicyName", &i.SigninPolicyName) + delete(rawMsg, key) + case "signinTenant": + err = unpopulate(val, "SigninTenant", &i.SigninTenant) + delete(rawMsg, key) + case "signupPolicyName": + err = unpopulate(val, "SignupPolicyName", &i.SignupPolicyName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseBody. -func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IdentityProviderContract. +func (i IdentityProviderContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseBody. -func (e *ErrorResponseBody) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderContract. +func (i *IdentityProviderContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) + case "id": + err = unpopulate(val, "ID", &i.ID) delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) + case "name": + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GatewayCertificateAuthorityCollection. -func (g GatewayCertificateAuthorityCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IdentityProviderContractProperties. +func (i IdentityProviderContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) + populate(objectMap, "allowedTenants", i.AllowedTenants) + populate(objectMap, "authority", i.Authority) + populate(objectMap, "clientId", i.ClientID) + populate(objectMap, "clientLibrary", i.ClientLibrary) + populate(objectMap, "clientSecret", i.ClientSecret) + populate(objectMap, "passwordResetPolicyName", i.PasswordResetPolicyName) + populate(objectMap, "profileEditingPolicyName", i.ProfileEditingPolicyName) + populate(objectMap, "signinPolicyName", i.SigninPolicyName) + populate(objectMap, "signinTenant", i.SigninTenant) + populate(objectMap, "signupPolicyName", i.SignupPolicyName) + populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayCertificateAuthorityCollection. -func (g *GatewayCertificateAuthorityCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderContractProperties. +func (i *IdentityProviderContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) + case "allowedTenants": + err = unpopulate(val, "AllowedTenants", &i.AllowedTenants) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) + case "authority": + err = unpopulate(val, "Authority", &i.Authority) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &i.ClientID) + delete(rawMsg, key) + case "clientLibrary": + err = unpopulate(val, "ClientLibrary", &i.ClientLibrary) + delete(rawMsg, key) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &i.ClientSecret) + delete(rawMsg, key) + case "passwordResetPolicyName": + err = unpopulate(val, "PasswordResetPolicyName", &i.PasswordResetPolicyName) + delete(rawMsg, key) + case "profileEditingPolicyName": + err = unpopulate(val, "ProfileEditingPolicyName", &i.ProfileEditingPolicyName) + delete(rawMsg, key) + case "signinPolicyName": + err = unpopulate(val, "SigninPolicyName", &i.SigninPolicyName) + delete(rawMsg, key) + case "signinTenant": + err = unpopulate(val, "SigninTenant", &i.SigninTenant) + delete(rawMsg, key) + case "signupPolicyName": + err = unpopulate(val, "SignupPolicyName", &i.SignupPolicyName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GatewayCertificateAuthorityContract. -func (g GatewayCertificateAuthorityContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IdentityProviderCreateContract. +func (i IdentityProviderCreateContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", g.ID) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "type", g.Type) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayCertificateAuthorityContract. -func (g *GatewayCertificateAuthorityContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderCreateContract. +func (i *IdentityProviderCreateContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &g.ID) + err = unpopulate(val, "ID", &i.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &g.Name) + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &g.Properties) + err = unpopulate(val, "Properties", &i.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &g.Type) + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GatewayCertificateAuthorityContractProperties. -func (g GatewayCertificateAuthorityContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IdentityProviderCreateContractProperties. +func (i IdentityProviderCreateContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "isTrusted", g.IsTrusted) + populate(objectMap, "allowedTenants", i.AllowedTenants) + populate(objectMap, "authority", i.Authority) + populate(objectMap, "clientId", i.ClientID) + populate(objectMap, "clientLibrary", i.ClientLibrary) + populate(objectMap, "clientSecret", i.ClientSecret) + populate(objectMap, "passwordResetPolicyName", i.PasswordResetPolicyName) + populate(objectMap, "profileEditingPolicyName", i.ProfileEditingPolicyName) + populate(objectMap, "signinPolicyName", i.SigninPolicyName) + populate(objectMap, "signinTenant", i.SigninTenant) + populate(objectMap, "signupPolicyName", i.SignupPolicyName) + populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayCertificateAuthorityContractProperties. -func (g *GatewayCertificateAuthorityContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderCreateContractProperties. +func (i *IdentityProviderCreateContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "isTrusted": - err = unpopulate(val, "IsTrusted", &g.IsTrusted) + case "allowedTenants": + err = unpopulate(val, "AllowedTenants", &i.AllowedTenants) + delete(rawMsg, key) + case "authority": + err = unpopulate(val, "Authority", &i.Authority) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &i.ClientID) + delete(rawMsg, key) + case "clientLibrary": + err = unpopulate(val, "ClientLibrary", &i.ClientLibrary) + delete(rawMsg, key) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &i.ClientSecret) + delete(rawMsg, key) + case "passwordResetPolicyName": + err = unpopulate(val, "PasswordResetPolicyName", &i.PasswordResetPolicyName) + delete(rawMsg, key) + case "profileEditingPolicyName": + err = unpopulate(val, "ProfileEditingPolicyName", &i.ProfileEditingPolicyName) + delete(rawMsg, key) + case "signinPolicyName": + err = unpopulate(val, "SigninPolicyName", &i.SigninPolicyName) + delete(rawMsg, key) + case "signinTenant": + err = unpopulate(val, "SigninTenant", &i.SigninTenant) + delete(rawMsg, key) + case "signupPolicyName": + err = unpopulate(val, "SignupPolicyName", &i.SignupPolicyName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GatewayCollection. -func (g GatewayCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IdentityProviderList. +func (i IdentityProviderList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", g.Count) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) + populate(objectMap, "count", i.Count) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayCollection. -func (g *GatewayCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderList. +func (i *IdentityProviderList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { case "count": - err = unpopulate(val, "Count", &g.Count) + err = unpopulate(val, "Count", &i.Count) delete(rawMsg, key) case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) + err = unpopulate(val, "NextLink", &i.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &g.Value) + err = unpopulate(val, "Value", &i.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GatewayContract. -func (g GatewayContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IdentityProviderUpdateParameters. +func (i IdentityProviderUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", g.ID) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "type", g.Type) + populate(objectMap, "properties", i.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayContract. -func (g *GatewayContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderUpdateParameters. +func (i *IdentityProviderUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &g.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &g.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) + err = unpopulate(val, "Properties", &i.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GatewayContractProperties. -func (g GatewayContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IdentityProviderUpdateProperties. +func (i IdentityProviderUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", g.Description) - populate(objectMap, "locationData", g.LocationData) + populate(objectMap, "allowedTenants", i.AllowedTenants) + populate(objectMap, "authority", i.Authority) + populate(objectMap, "clientId", i.ClientID) + populate(objectMap, "clientLibrary", i.ClientLibrary) + populate(objectMap, "clientSecret", i.ClientSecret) + populate(objectMap, "passwordResetPolicyName", i.PasswordResetPolicyName) + populate(objectMap, "profileEditingPolicyName", i.ProfileEditingPolicyName) + populate(objectMap, "signinPolicyName", i.SigninPolicyName) + populate(objectMap, "signinTenant", i.SigninTenant) + populate(objectMap, "signupPolicyName", i.SignupPolicyName) + populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayContractProperties. -func (g *GatewayContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderUpdateProperties. +func (i *IdentityProviderUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &g.Description) + case "allowedTenants": + err = unpopulate(val, "AllowedTenants", &i.AllowedTenants) delete(rawMsg, key) - case "locationData": - err = unpopulate(val, "LocationData", &g.LocationData) + case "authority": + err = unpopulate(val, "Authority", &i.Authority) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &i.ClientID) + delete(rawMsg, key) + case "clientLibrary": + err = unpopulate(val, "ClientLibrary", &i.ClientLibrary) + delete(rawMsg, key) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &i.ClientSecret) + delete(rawMsg, key) + case "passwordResetPolicyName": + err = unpopulate(val, "PasswordResetPolicyName", &i.PasswordResetPolicyName) + delete(rawMsg, key) + case "profileEditingPolicyName": + err = unpopulate(val, "ProfileEditingPolicyName", &i.ProfileEditingPolicyName) + delete(rawMsg, key) + case "signinPolicyName": + err = unpopulate(val, "SigninPolicyName", &i.SigninPolicyName) + delete(rawMsg, key) + case "signinTenant": + err = unpopulate(val, "SigninTenant", &i.SigninTenant) + delete(rawMsg, key) + case "signupPolicyName": + err = unpopulate(val, "SignupPolicyName", &i.SignupPolicyName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GatewayHostnameConfigurationCollection. -func (g GatewayHostnameConfigurationCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IssueAttachmentCollection. +func (i IssueAttachmentCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) + populate(objectMap, "count", i.Count) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayHostnameConfigurationCollection. -func (g *GatewayHostnameConfigurationCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IssueAttachmentCollection. +func (i *IssueAttachmentCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { + case "count": + err = unpopulate(val, "Count", &i.Count) + delete(rawMsg, key) case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) + err = unpopulate(val, "NextLink", &i.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &g.Value) + err = unpopulate(val, "Value", &i.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GatewayHostnameConfigurationContract. -func (g GatewayHostnameConfigurationContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IssueAttachmentContract. +func (i IssueAttachmentContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", g.ID) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "type", g.Type) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayHostnameConfigurationContract. -func (g *GatewayHostnameConfigurationContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IssueAttachmentContract. +func (i *IssueAttachmentContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &g.ID) + err = unpopulate(val, "ID", &i.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &g.Name) + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &g.Properties) + err = unpopulate(val, "Properties", &i.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &g.Type) + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GatewayHostnameConfigurationContractProperties. -func (g GatewayHostnameConfigurationContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IssueAttachmentContractProperties. +func (i IssueAttachmentContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "certificateId", g.CertificateID) - populate(objectMap, "http2Enabled", g.HTTP2Enabled) - populate(objectMap, "hostname", g.Hostname) - populate(objectMap, "negotiateClientCertificate", g.NegotiateClientCertificate) - populate(objectMap, "tls10Enabled", g.Tls10Enabled) - populate(objectMap, "tls11Enabled", g.Tls11Enabled) + populate(objectMap, "content", i.Content) + populate(objectMap, "contentFormat", i.ContentFormat) + populate(objectMap, "title", i.Title) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayHostnameConfigurationContractProperties. -func (g *GatewayHostnameConfigurationContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IssueAttachmentContractProperties. +func (i *IssueAttachmentContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "certificateId": - err = unpopulate(val, "CertificateID", &g.CertificateID) - delete(rawMsg, key) - case "http2Enabled": - err = unpopulate(val, "HTTP2Enabled", &g.HTTP2Enabled) - delete(rawMsg, key) - case "hostname": - err = unpopulate(val, "Hostname", &g.Hostname) - delete(rawMsg, key) - case "negotiateClientCertificate": - err = unpopulate(val, "NegotiateClientCertificate", &g.NegotiateClientCertificate) + case "content": + err = unpopulate(val, "Content", &i.Content) delete(rawMsg, key) - case "tls10Enabled": - err = unpopulate(val, "Tls10Enabled", &g.Tls10Enabled) + case "contentFormat": + err = unpopulate(val, "ContentFormat", &i.ContentFormat) delete(rawMsg, key) - case "tls11Enabled": - err = unpopulate(val, "Tls11Enabled", &g.Tls11Enabled) + case "title": + err = unpopulate(val, "Title", &i.Title) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GatewayKeyRegenerationRequestContract. -func (g GatewayKeyRegenerationRequestContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IssueCollection. +func (i IssueCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "keyType", g.KeyType) + populate(objectMap, "count", i.Count) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayKeyRegenerationRequestContract. -func (g *GatewayKeyRegenerationRequestContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IssueCollection. +func (i *IssueCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "keyType": - err = unpopulate(val, "KeyType", &g.KeyType) + case "count": + err = unpopulate(val, "Count", &i.Count) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GatewayKeysContract. -func (g GatewayKeysContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IssueCommentCollection. +func (i IssueCommentCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "primary", g.Primary) - populate(objectMap, "secondary", g.Secondary) + populate(objectMap, "count", i.Count) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayKeysContract. -func (g *GatewayKeysContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IssueCommentCollection. +func (i *IssueCommentCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "primary": - err = unpopulate(val, "Primary", &g.Primary) + case "count": + err = unpopulate(val, "Count", &i.Count) delete(rawMsg, key) - case "secondary": - err = unpopulate(val, "Secondary", &g.Secondary) + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GatewayTokenContract. -func (g GatewayTokenContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IssueCommentContract. +func (i IssueCommentContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", g.Value) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayTokenContract. -func (g *GatewayTokenContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IssueCommentContract. +func (i *IssueCommentContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &g.Value) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GatewayTokenRequestContract. -func (g GatewayTokenRequestContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IssueCommentContractProperties. +func (i IssueCommentContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "expiry", g.Expiry) - populate(objectMap, "keyType", g.KeyType) + populateTimeRFC3339(objectMap, "createdDate", i.CreatedDate) + populate(objectMap, "text", i.Text) + populate(objectMap, "userId", i.UserID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayTokenRequestContract. -func (g *GatewayTokenRequestContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IssueCommentContractProperties. +func (i *IssueCommentContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "expiry": - err = unpopulateTimeRFC3339(val, "Expiry", &g.Expiry) + case "createdDate": + err = unpopulateTimeRFC3339(val, "CreatedDate", &i.CreatedDate) delete(rawMsg, key) - case "keyType": - err = unpopulate(val, "KeyType", &g.KeyType) + case "text": + err = unpopulate(val, "Text", &i.Text) + delete(rawMsg, key) + case "userId": + err = unpopulate(val, "UserID", &i.UserID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GenerateSsoURLResult. -func (g GenerateSsoURLResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IssueContract. +func (i IssueContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", g.Value) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateSsoURLResult. -func (g *GenerateSsoURLResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IssueContract. +func (i *IssueContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &g.Value) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GlobalSchemaCollection. -func (g GlobalSchemaCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IssueContractBaseProperties. +func (i IssueContractBaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", g.Count) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) + populate(objectMap, "apiId", i.APIID) + populateTimeRFC3339(objectMap, "createdDate", i.CreatedDate) + populate(objectMap, "state", i.State) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalSchemaCollection. -func (g *GlobalSchemaCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IssueContractBaseProperties. +func (i *IssueContractBaseProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &g.Count) + case "apiId": + err = unpopulate(val, "APIID", &i.APIID) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) + case "createdDate": + err = unpopulateTimeRFC3339(val, "CreatedDate", &i.CreatedDate) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) + case "state": + err = unpopulate(val, "State", &i.State) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GlobalSchemaContract. -func (g GlobalSchemaContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IssueContractProperties. +func (i IssueContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", g.ID) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "type", g.Type) + populate(objectMap, "apiId", i.APIID) + populateTimeRFC3339(objectMap, "createdDate", i.CreatedDate) + populate(objectMap, "description", i.Description) + populate(objectMap, "state", i.State) + populate(objectMap, "title", i.Title) + populate(objectMap, "userId", i.UserID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalSchemaContract. -func (g *GlobalSchemaContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IssueContractProperties. +func (i *IssueContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &g.ID) + case "apiId": + err = unpopulate(val, "APIID", &i.APIID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) + case "createdDate": + err = unpopulateTimeRFC3339(val, "CreatedDate", &i.CreatedDate) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) + case "description": + err = unpopulate(val, "Description", &i.Description) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) + case "state": + err = unpopulate(val, "State", &i.State) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &i.Title) + delete(rawMsg, key) + case "userId": + err = unpopulate(val, "UserID", &i.UserID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GlobalSchemaContractProperties. -func (g GlobalSchemaContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IssueUpdateContract. +func (i IssueUpdateContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", g.Description) - populateAny(objectMap, "document", g.Document) - populate(objectMap, "schemaType", g.SchemaType) - populateAny(objectMap, "value", g.Value) + populate(objectMap, "properties", i.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalSchemaContractProperties. -func (g *GlobalSchemaContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IssueUpdateContract. +func (i *IssueUpdateContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &g.Description) - delete(rawMsg, key) - case "document": - err = unpopulate(val, "Document", &g.Document) - delete(rawMsg, key) - case "schemaType": - err = unpopulate(val, "SchemaType", &g.SchemaType) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupCollection. -func (g GroupCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IssueUpdateContractProperties. +func (i IssueUpdateContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", g.Count) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) + populate(objectMap, "apiId", i.APIID) + populateTimeRFC3339(objectMap, "createdDate", i.CreatedDate) + populate(objectMap, "description", i.Description) + populate(objectMap, "state", i.State) + populate(objectMap, "title", i.Title) + populate(objectMap, "userId", i.UserID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupCollection. -func (g *GroupCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IssueUpdateContractProperties. +func (i *IssueUpdateContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &g.Count) + case "apiId": + err = unpopulate(val, "APIID", &i.APIID) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) + case "createdDate": + err = unpopulateTimeRFC3339(val, "CreatedDate", &i.CreatedDate) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) + case "description": + err = unpopulate(val, "Description", &i.Description) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &i.State) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &i.Title) + delete(rawMsg, key) + case "userId": + err = unpopulate(val, "UserID", &i.UserID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupContract. -func (g GroupContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type KeyVaultContractCreateProperties. +func (k KeyVaultContractCreateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", g.ID) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "type", g.Type) + populate(objectMap, "identityClientId", k.IdentityClientID) + populate(objectMap, "secretIdentifier", k.SecretIdentifier) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupContract. -func (g *GroupContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultContractCreateProperties. +func (k *KeyVaultContractCreateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &g.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) + case "identityClientId": + err = unpopulate(val, "IdentityClientID", &k.IdentityClientID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) + case "secretIdentifier": + err = unpopulate(val, "SecretIdentifier", &k.SecretIdentifier) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupContractProperties. -func (g GroupContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type KeyVaultContractProperties. +func (k KeyVaultContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "builtIn", g.BuiltIn) - populate(objectMap, "description", g.Description) - populate(objectMap, "displayName", g.DisplayName) - populate(objectMap, "externalId", g.ExternalID) - populate(objectMap, "type", g.Type) + populate(objectMap, "identityClientId", k.IdentityClientID) + populate(objectMap, "lastStatus", k.LastStatus) + populate(objectMap, "secretIdentifier", k.SecretIdentifier) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupContractProperties. -func (g *GroupContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultContractProperties. +func (k *KeyVaultContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } for key, val := range rawMsg { var err error switch key { - case "builtIn": - err = unpopulate(val, "BuiltIn", &g.BuiltIn) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &g.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &g.DisplayName) + case "identityClientId": + err = unpopulate(val, "IdentityClientID", &k.IdentityClientID) delete(rawMsg, key) - case "externalId": - err = unpopulate(val, "ExternalID", &g.ExternalID) + case "lastStatus": + err = unpopulate(val, "LastStatus", &k.LastStatus) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) + case "secretIdentifier": + err = unpopulate(val, "SecretIdentifier", &k.SecretIdentifier) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupCreateParameters. -func (g GroupCreateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type KeyVaultLastAccessStatusContractProperties. +func (k KeyVaultLastAccessStatusContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", g.Properties) + populate(objectMap, "code", k.Code) + populate(objectMap, "message", k.Message) + populateTimeRFC3339(objectMap, "timeStampUtc", k.TimeStampUTC) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupCreateParameters. -func (g *GroupCreateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultLastAccessStatusContractProperties. +func (k *KeyVaultLastAccessStatusContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &g.Properties) + case "code": + err = unpopulate(val, "Code", &k.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &k.Message) + delete(rawMsg, key) + case "timeStampUtc": + err = unpopulateTimeRFC3339(val, "TimeStampUTC", &k.TimeStampUTC) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupCreateParametersProperties. -func (g GroupCreateParametersProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LoggerCollection. +func (l LoggerCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", g.Description) - populate(objectMap, "displayName", g.DisplayName) - populate(objectMap, "externalId", g.ExternalID) - populate(objectMap, "type", g.Type) + populate(objectMap, "count", l.Count) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupCreateParametersProperties. -func (g *GroupCreateParametersProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LoggerCollection. +func (l *LoggerCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &g.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &g.DisplayName) + case "count": + err = unpopulate(val, "Count", &l.Count) delete(rawMsg, key) - case "externalId": - err = unpopulate(val, "ExternalID", &g.ExternalID) + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) + case "value": + err = unpopulate(val, "Value", &l.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupUpdateParameters. -func (g GroupUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LoggerContract. +func (l LoggerContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", g.Properties) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "type", l.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupUpdateParameters. -func (g *GroupUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LoggerContract. +func (l *LoggerContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &g.Properties) + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupUpdateParametersProperties. -func (g GroupUpdateParametersProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LoggerContractProperties. +func (l LoggerContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", g.Description) - populate(objectMap, "displayName", g.DisplayName) - populate(objectMap, "externalId", g.ExternalID) - populate(objectMap, "type", g.Type) + populate(objectMap, "credentials", l.Credentials) + populate(objectMap, "description", l.Description) + populate(objectMap, "isBuffered", l.IsBuffered) + populate(objectMap, "loggerType", l.LoggerType) + populate(objectMap, "resourceId", l.ResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupUpdateParametersProperties. -func (g *GroupUpdateParametersProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LoggerContractProperties. +func (l *LoggerContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { + case "credentials": + err = unpopulate(val, "Credentials", &l.Credentials) + delete(rawMsg, key) case "description": - err = unpopulate(val, "Description", &g.Description) + err = unpopulate(val, "Description", &l.Description) delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &g.DisplayName) + case "isBuffered": + err = unpopulate(val, "IsBuffered", &l.IsBuffered) delete(rawMsg, key) - case "externalId": - err = unpopulate(val, "ExternalID", &g.ExternalID) + case "loggerType": + err = unpopulate(val, "LoggerType", &l.LoggerType) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) + case "resourceId": + err = unpopulate(val, "ResourceID", &l.ResourceID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HTTPHeader. -func (h HTTPHeader) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LoggerUpdateContract. +func (l LoggerUpdateContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", h.Name) - populate(objectMap, "value", h.Value) + populate(objectMap, "properties", l.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPHeader. -func (h *HTTPHeader) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LoggerUpdateContract. +func (l *LoggerUpdateContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &h.Name) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &h.Value) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HTTPMessageDiagnostic. -func (h HTTPMessageDiagnostic) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LoggerUpdateParameters. +func (l LoggerUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "body", h.Body) - populate(objectMap, "dataMasking", h.DataMasking) - populate(objectMap, "headers", h.Headers) + populate(objectMap, "credentials", l.Credentials) + populate(objectMap, "description", l.Description) + populate(objectMap, "isBuffered", l.IsBuffered) + populate(objectMap, "loggerType", l.LoggerType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPMessageDiagnostic. -func (h *HTTPMessageDiagnostic) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LoggerUpdateParameters. +func (l *LoggerUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "body": - err = unpopulate(val, "Body", &h.Body) + case "credentials": + err = unpopulate(val, "Credentials", &l.Credentials) delete(rawMsg, key) - case "dataMasking": - err = unpopulate(val, "DataMasking", &h.DataMasking) + case "description": + err = unpopulate(val, "Description", &l.Description) delete(rawMsg, key) - case "headers": - err = unpopulate(val, "Headers", &h.Headers) + case "isBuffered": + err = unpopulate(val, "IsBuffered", &l.IsBuffered) + delete(rawMsg, key) + case "loggerType": + err = unpopulate(val, "LoggerType", &l.LoggerType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HostnameConfiguration. -func (h HostnameConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MigrateToStv2Contract. +func (m MigrateToStv2Contract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "certificate", h.Certificate) - populate(objectMap, "certificatePassword", h.CertificatePassword) - populate(objectMap, "certificateSource", h.CertificateSource) - populate(objectMap, "certificateStatus", h.CertificateStatus) - populate(objectMap, "defaultSslBinding", h.DefaultSSLBinding) - populate(objectMap, "encodedCertificate", h.EncodedCertificate) - populate(objectMap, "hostName", h.HostName) - populate(objectMap, "identityClientId", h.IdentityClientID) - populate(objectMap, "keyVaultId", h.KeyVaultID) - populate(objectMap, "negotiateClientCertificate", h.NegotiateClientCertificate) - populate(objectMap, "type", h.Type) + populate(objectMap, "mode", m.Mode) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HostnameConfiguration. -func (h *HostnameConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MigrateToStv2Contract. +func (m *MigrateToStv2Contract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "certificate": - err = unpopulate(val, "Certificate", &h.Certificate) - delete(rawMsg, key) - case "certificatePassword": - err = unpopulate(val, "CertificatePassword", &h.CertificatePassword) - delete(rawMsg, key) - case "certificateSource": - err = unpopulate(val, "CertificateSource", &h.CertificateSource) - delete(rawMsg, key) - case "certificateStatus": - err = unpopulate(val, "CertificateStatus", &h.CertificateStatus) - delete(rawMsg, key) - case "defaultSslBinding": - err = unpopulate(val, "DefaultSSLBinding", &h.DefaultSSLBinding) - delete(rawMsg, key) - case "encodedCertificate": - err = unpopulate(val, "EncodedCertificate", &h.EncodedCertificate) - delete(rawMsg, key) - case "hostName": - err = unpopulate(val, "HostName", &h.HostName) - delete(rawMsg, key) - case "identityClientId": - err = unpopulate(val, "IdentityClientID", &h.IdentityClientID) - delete(rawMsg, key) - case "keyVaultId": - err = unpopulate(val, "KeyVaultID", &h.KeyVaultID) - delete(rawMsg, key) - case "negotiateClientCertificate": - err = unpopulate(val, "NegotiateClientCertificate", &h.NegotiateClientCertificate) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &h.Type) + case "mode": + err = unpopulate(val, "Mode", &m.Mode) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IdentityProviderBaseParameters. -func (i IdentityProviderBaseParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allowedTenants", i.AllowedTenants) - populate(objectMap, "authority", i.Authority) - populate(objectMap, "passwordResetPolicyName", i.PasswordResetPolicyName) - populate(objectMap, "profileEditingPolicyName", i.ProfileEditingPolicyName) - populate(objectMap, "signinPolicyName", i.SigninPolicyName) - populate(objectMap, "signinTenant", i.SigninTenant) - populate(objectMap, "signupPolicyName", i.SignupPolicyName) - populate(objectMap, "type", i.Type) +// MarshalJSON implements the json.Marshaller interface for type NamedValueCollection. +func (n NamedValueCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", n.Count) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderBaseParameters. -func (i *IdentityProviderBaseParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueCollection. +func (n *NamedValueCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "allowedTenants": - err = unpopulate(val, "AllowedTenants", &i.AllowedTenants) - delete(rawMsg, key) - case "authority": - err = unpopulate(val, "Authority", &i.Authority) - delete(rawMsg, key) - case "passwordResetPolicyName": - err = unpopulate(val, "PasswordResetPolicyName", &i.PasswordResetPolicyName) - delete(rawMsg, key) - case "profileEditingPolicyName": - err = unpopulate(val, "ProfileEditingPolicyName", &i.ProfileEditingPolicyName) - delete(rawMsg, key) - case "signinPolicyName": - err = unpopulate(val, "SigninPolicyName", &i.SigninPolicyName) - delete(rawMsg, key) - case "signinTenant": - err = unpopulate(val, "SigninTenant", &i.SigninTenant) + case "count": + err = unpopulate(val, "Count", &n.Count) delete(rawMsg, key) - case "signupPolicyName": - err = unpopulate(val, "SignupPolicyName", &i.SignupPolicyName) + case "nextLink": + err = unpopulate(val, "NextLink", &n.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "value": + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IdentityProviderContract. -func (i IdentityProviderContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NamedValueContract. +func (n NamedValueContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "type", i.Type) + populate(objectMap, "id", n.ID) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "type", n.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderContract. -func (i *IdentityProviderContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueContract. +func (n *NamedValueContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &i.ID) + err = unpopulate(val, "ID", &n.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &i.Name) + err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &i.Properties) + err = unpopulate(val, "Properties", &n.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &i.Type) + err = unpopulate(val, "Type", &n.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IdentityProviderContractProperties. -func (i IdentityProviderContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NamedValueContractProperties. +func (n NamedValueContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "allowedTenants", i.AllowedTenants) - populate(objectMap, "authority", i.Authority) - populate(objectMap, "clientId", i.ClientID) - populate(objectMap, "clientSecret", i.ClientSecret) - populate(objectMap, "passwordResetPolicyName", i.PasswordResetPolicyName) - populate(objectMap, "profileEditingPolicyName", i.ProfileEditingPolicyName) - populate(objectMap, "signinPolicyName", i.SigninPolicyName) - populate(objectMap, "signinTenant", i.SigninTenant) - populate(objectMap, "signupPolicyName", i.SignupPolicyName) - populate(objectMap, "type", i.Type) + populate(objectMap, "displayName", n.DisplayName) + populate(objectMap, "keyVault", n.KeyVault) + populate(objectMap, "secret", n.Secret) + populate(objectMap, "tags", n.Tags) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderContractProperties. -func (i *IdentityProviderContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueContractProperties. +func (n *NamedValueContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "allowedTenants": - err = unpopulate(val, "AllowedTenants", &i.AllowedTenants) - delete(rawMsg, key) - case "authority": - err = unpopulate(val, "Authority", &i.Authority) - delete(rawMsg, key) - case "clientId": - err = unpopulate(val, "ClientID", &i.ClientID) - delete(rawMsg, key) - case "clientSecret": - err = unpopulate(val, "ClientSecret", &i.ClientSecret) - delete(rawMsg, key) - case "passwordResetPolicyName": - err = unpopulate(val, "PasswordResetPolicyName", &i.PasswordResetPolicyName) - delete(rawMsg, key) - case "profileEditingPolicyName": - err = unpopulate(val, "ProfileEditingPolicyName", &i.ProfileEditingPolicyName) + case "displayName": + err = unpopulate(val, "DisplayName", &n.DisplayName) delete(rawMsg, key) - case "signinPolicyName": - err = unpopulate(val, "SigninPolicyName", &i.SigninPolicyName) + case "keyVault": + err = unpopulate(val, "KeyVault", &n.KeyVault) delete(rawMsg, key) - case "signinTenant": - err = unpopulate(val, "SigninTenant", &i.SigninTenant) + case "secret": + err = unpopulate(val, "Secret", &n.Secret) delete(rawMsg, key) - case "signupPolicyName": - err = unpopulate(val, "SignupPolicyName", &i.SignupPolicyName) + case "tags": + err = unpopulate(val, "Tags", &n.Tags) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "value": + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IdentityProviderCreateContract. -func (i IdentityProviderCreateContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NamedValueCreateContract. +func (n NamedValueCreateContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "type", i.Type) + populate(objectMap, "id", n.ID) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "type", n.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderCreateContract. -func (i *IdentityProviderCreateContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueCreateContract. +func (n *NamedValueCreateContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &i.ID) + err = unpopulate(val, "ID", &n.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &i.Name) + err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &i.Properties) + err = unpopulate(val, "Properties", &n.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &i.Type) + err = unpopulate(val, "Type", &n.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IdentityProviderCreateContractProperties. -func (i IdentityProviderCreateContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NamedValueCreateContractProperties. +func (n NamedValueCreateContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "allowedTenants", i.AllowedTenants) - populate(objectMap, "authority", i.Authority) - populate(objectMap, "clientId", i.ClientID) - populate(objectMap, "clientSecret", i.ClientSecret) - populate(objectMap, "passwordResetPolicyName", i.PasswordResetPolicyName) - populate(objectMap, "profileEditingPolicyName", i.ProfileEditingPolicyName) - populate(objectMap, "signinPolicyName", i.SigninPolicyName) - populate(objectMap, "signinTenant", i.SigninTenant) - populate(objectMap, "signupPolicyName", i.SignupPolicyName) - populate(objectMap, "type", i.Type) + populate(objectMap, "displayName", n.DisplayName) + populate(objectMap, "keyVault", n.KeyVault) + populate(objectMap, "secret", n.Secret) + populate(objectMap, "tags", n.Tags) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderCreateContractProperties. -func (i *IdentityProviderCreateContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueCreateContractProperties. +func (n *NamedValueCreateContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "allowedTenants": - err = unpopulate(val, "AllowedTenants", &i.AllowedTenants) - delete(rawMsg, key) - case "authority": - err = unpopulate(val, "Authority", &i.Authority) - delete(rawMsg, key) - case "clientId": - err = unpopulate(val, "ClientID", &i.ClientID) - delete(rawMsg, key) - case "clientSecret": - err = unpopulate(val, "ClientSecret", &i.ClientSecret) + case "displayName": + err = unpopulate(val, "DisplayName", &n.DisplayName) delete(rawMsg, key) - case "passwordResetPolicyName": - err = unpopulate(val, "PasswordResetPolicyName", &i.PasswordResetPolicyName) + case "keyVault": + err = unpopulate(val, "KeyVault", &n.KeyVault) delete(rawMsg, key) - case "profileEditingPolicyName": - err = unpopulate(val, "ProfileEditingPolicyName", &i.ProfileEditingPolicyName) + case "secret": + err = unpopulate(val, "Secret", &n.Secret) delete(rawMsg, key) - case "signinPolicyName": - err = unpopulate(val, "SigninPolicyName", &i.SigninPolicyName) + case "tags": + err = unpopulate(val, "Tags", &n.Tags) delete(rawMsg, key) - case "signinTenant": - err = unpopulate(val, "SigninTenant", &i.SigninTenant) + case "value": + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) - case "signupPolicyName": - err = unpopulate(val, "SignupPolicyName", &i.SignupPolicyName) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NamedValueEntityBaseParameters. +func (n NamedValueEntityBaseParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "secret", n.Secret) + populate(objectMap, "tags", n.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueEntityBaseParameters. +func (n *NamedValueEntityBaseParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secret": + err = unpopulate(val, "Secret", &n.Secret) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "tags": + err = unpopulate(val, "Tags", &n.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IdentityProviderList. -func (i IdentityProviderList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NamedValueSecretContract. +func (n NamedValueSecretContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", i.Count) - populate(objectMap, "nextLink", i.NextLink) - populate(objectMap, "value", i.Value) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderList. -func (i *IdentityProviderList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueSecretContract. +func (n *NamedValueSecretContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &i.Count) - delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &i.NextLink) - delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &i.Value) + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IdentityProviderUpdateParameters. -func (i IdentityProviderUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NamedValueUpdateParameterProperties. +func (n NamedValueUpdateParameterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", i.Properties) + populate(objectMap, "displayName", n.DisplayName) + populate(objectMap, "keyVault", n.KeyVault) + populate(objectMap, "secret", n.Secret) + populate(objectMap, "tags", n.Tags) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderUpdateParameters. -func (i *IdentityProviderUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueUpdateParameterProperties. +func (n *NamedValueUpdateParameterProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &i.Properties) + case "displayName": + err = unpopulate(val, "DisplayName", &n.DisplayName) + delete(rawMsg, key) + case "keyVault": + err = unpopulate(val, "KeyVault", &n.KeyVault) + delete(rawMsg, key) + case "secret": + err = unpopulate(val, "Secret", &n.Secret) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &n.Tags) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IdentityProviderUpdateProperties. -func (i IdentityProviderUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NamedValueUpdateParameters. +func (n NamedValueUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "allowedTenants", i.AllowedTenants) - populate(objectMap, "authority", i.Authority) - populate(objectMap, "clientId", i.ClientID) - populate(objectMap, "clientSecret", i.ClientSecret) - populate(objectMap, "passwordResetPolicyName", i.PasswordResetPolicyName) - populate(objectMap, "profileEditingPolicyName", i.ProfileEditingPolicyName) - populate(objectMap, "signinPolicyName", i.SigninPolicyName) - populate(objectMap, "signinTenant", i.SigninTenant) - populate(objectMap, "signupPolicyName", i.SignupPolicyName) - populate(objectMap, "type", i.Type) + populate(objectMap, "properties", n.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviderUpdateProperties. -func (i *IdentityProviderUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueUpdateParameters. +func (n *NamedValueUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "allowedTenants": - err = unpopulate(val, "AllowedTenants", &i.AllowedTenants) - delete(rawMsg, key) - case "authority": - err = unpopulate(val, "Authority", &i.Authority) - delete(rawMsg, key) - case "clientId": - err = unpopulate(val, "ClientID", &i.ClientID) - delete(rawMsg, key) - case "clientSecret": - err = unpopulate(val, "ClientSecret", &i.ClientSecret) - delete(rawMsg, key) - case "passwordResetPolicyName": - err = unpopulate(val, "PasswordResetPolicyName", &i.PasswordResetPolicyName) - delete(rawMsg, key) - case "profileEditingPolicyName": - err = unpopulate(val, "ProfileEditingPolicyName", &i.ProfileEditingPolicyName) - delete(rawMsg, key) - case "signinPolicyName": - err = unpopulate(val, "SigninPolicyName", &i.SigninPolicyName) - delete(rawMsg, key) - case "signinTenant": - err = unpopulate(val, "SigninTenant", &i.SigninTenant) - delete(rawMsg, key) - case "signupPolicyName": - err = unpopulate(val, "SignupPolicyName", &i.SignupPolicyName) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IssueAttachmentCollection. -func (i IssueAttachmentCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkStatusContract. +func (n NetworkStatusContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", i.Count) - populate(objectMap, "nextLink", i.NextLink) - populate(objectMap, "value", i.Value) + populate(objectMap, "connectivityStatus", n.ConnectivityStatus) + populate(objectMap, "dnsServers", n.DNSServers) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IssueAttachmentCollection. -func (i *IssueAttachmentCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkStatusContract. +func (n *NetworkStatusContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &i.Count) - delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &i.NextLink) + case "connectivityStatus": + err = unpopulate(val, "ConnectivityStatus", &n.ConnectivityStatus) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &i.Value) + case "dnsServers": + err = unpopulate(val, "DNSServers", &n.DNSServers) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IssueAttachmentContract. -func (i IssueAttachmentContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkStatusContractByLocation. +func (n NetworkStatusContractByLocation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "type", i.Type) + populate(objectMap, "location", n.Location) + populate(objectMap, "networkStatus", n.NetworkStatus) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IssueAttachmentContract. -func (i *IssueAttachmentContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkStatusContractByLocation. +func (n *NetworkStatusContractByLocation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) + case "location": + err = unpopulate(val, "Location", &n.Location) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "networkStatus": + err = unpopulate(val, "NetworkStatus", &n.NetworkStatus) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IssueAttachmentContractProperties. -func (i IssueAttachmentContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NotificationCollection. +func (n NotificationCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "content", i.Content) - populate(objectMap, "contentFormat", i.ContentFormat) - populate(objectMap, "title", i.Title) + populate(objectMap, "count", n.Count) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IssueAttachmentContractProperties. -func (i *IssueAttachmentContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationCollection. +func (n *NotificationCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "content": - err = unpopulate(val, "Content", &i.Content) + case "count": + err = unpopulate(val, "Count", &n.Count) delete(rawMsg, key) - case "contentFormat": - err = unpopulate(val, "ContentFormat", &i.ContentFormat) + case "nextLink": + err = unpopulate(val, "NextLink", &n.NextLink) delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &i.Title) + case "value": + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IssueCollection. -func (i IssueCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NotificationContract. +func (n NotificationContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", i.Count) - populate(objectMap, "nextLink", i.NextLink) - populate(objectMap, "value", i.Value) + populate(objectMap, "id", n.ID) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "type", n.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IssueCollection. -func (i *IssueCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationContract. +func (n *NotificationContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &i.Count) + case "id": + err = unpopulate(val, "ID", &n.ID) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &i.NextLink) + case "name": + err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &i.Value) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IssueCommentCollection. -func (i IssueCommentCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NotificationContractProperties. +func (n NotificationContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", i.Count) - populate(objectMap, "nextLink", i.NextLink) - populate(objectMap, "value", i.Value) + populate(objectMap, "description", n.Description) + populate(objectMap, "recipients", n.Recipients) + populate(objectMap, "title", n.Title) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IssueCommentCollection. -func (i *IssueCommentCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationContractProperties. +func (n *NotificationContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &i.Count) + case "description": + err = unpopulate(val, "Description", &n.Description) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &i.NextLink) + case "recipients": + err = unpopulate(val, "Recipients", &n.Recipients) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &i.Value) + case "title": + err = unpopulate(val, "Title", &n.Title) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IssueCommentContract. -func (i IssueCommentContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OAuth2AuthenticationSettingsContract. +func (o OAuth2AuthenticationSettingsContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "type", i.Type) + populate(objectMap, "authorizationServerId", o.AuthorizationServerID) + populate(objectMap, "scope", o.Scope) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IssueCommentContract. -func (i *IssueCommentContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OAuth2AuthenticationSettingsContract. +func (o *OAuth2AuthenticationSettingsContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) + case "authorizationServerId": + err = unpopulate(val, "AuthorizationServerID", &o.AuthorizationServerID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "scope": + err = unpopulate(val, "Scope", &o.Scope) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IssueCommentContractProperties. -func (i IssueCommentContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OpenIDAuthenticationSettingsContract. +func (o OpenIDAuthenticationSettingsContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdDate", i.CreatedDate) - populate(objectMap, "text", i.Text) - populate(objectMap, "userId", i.UserID) + populate(objectMap, "bearerTokenSendingMethods", o.BearerTokenSendingMethods) + populate(objectMap, "openidProviderId", o.OpenidProviderID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IssueCommentContractProperties. -func (i *IssueCommentContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OpenIDAuthenticationSettingsContract. +func (o *OpenIDAuthenticationSettingsContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "createdDate": - err = unpopulateTimeRFC3339(val, "CreatedDate", &i.CreatedDate) - delete(rawMsg, key) - case "text": - err = unpopulate(val, "Text", &i.Text) + case "bearerTokenSendingMethods": + err = unpopulate(val, "BearerTokenSendingMethods", &o.BearerTokenSendingMethods) delete(rawMsg, key) - case "userId": - err = unpopulate(val, "UserID", &i.UserID) + case "openidProviderId": + err = unpopulate(val, "OpenidProviderID", &o.OpenidProviderID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IssueContract. -func (i IssueContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OpenIDConnectProviderCollection. +func (o OpenIDConnectProviderCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "type", i.Type) + populate(objectMap, "count", o.Count) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IssueContract. -func (i *IssueContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OpenIDConnectProviderCollection. +func (o *OpenIDConnectProviderCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) + case "count": + err = unpopulate(val, "Count", &o.Count) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "value": + err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IssueContractBaseProperties. -func (i IssueContractBaseProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OpenidConnectProviderContract. +func (o OpenidConnectProviderContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apiId", i.APIID) - populateTimeRFC3339(objectMap, "createdDate", i.CreatedDate) - populate(objectMap, "state", i.State) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "type", o.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IssueContractBaseProperties. -func (i *IssueContractBaseProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OpenidConnectProviderContract. +func (o *OpenidConnectProviderContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "apiId": - err = unpopulate(val, "APIID", &i.APIID) + case "id": + err = unpopulate(val, "ID", &o.ID) delete(rawMsg, key) - case "createdDate": - err = unpopulateTimeRFC3339(val, "CreatedDate", &i.CreatedDate) + case "name": + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &i.State) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IssueContractProperties. -func (i IssueContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OpenidConnectProviderContractProperties. +func (o OpenidConnectProviderContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apiId", i.APIID) - populateTimeRFC3339(objectMap, "createdDate", i.CreatedDate) - populate(objectMap, "description", i.Description) - populate(objectMap, "state", i.State) - populate(objectMap, "title", i.Title) - populate(objectMap, "userId", i.UserID) + populate(objectMap, "clientId", o.ClientID) + populate(objectMap, "clientSecret", o.ClientSecret) + populate(objectMap, "description", o.Description) + populate(objectMap, "displayName", o.DisplayName) + populate(objectMap, "metadataEndpoint", o.MetadataEndpoint) + populate(objectMap, "useInApiDocumentation", o.UseInAPIDocumentation) + populate(objectMap, "useInTestConsole", o.UseInTestConsole) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IssueContractProperties. -func (i *IssueContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OpenidConnectProviderContractProperties. +func (o *OpenidConnectProviderContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "apiId": - err = unpopulate(val, "APIID", &i.APIID) + case "clientId": + err = unpopulate(val, "ClientID", &o.ClientID) delete(rawMsg, key) - case "createdDate": - err = unpopulateTimeRFC3339(val, "CreatedDate", &i.CreatedDate) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &o.ClientSecret) delete(rawMsg, key) case "description": - err = unpopulate(val, "Description", &i.Description) + err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &i.State) + case "displayName": + err = unpopulate(val, "DisplayName", &o.DisplayName) delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &i.Title) + case "metadataEndpoint": + err = unpopulate(val, "MetadataEndpoint", &o.MetadataEndpoint) delete(rawMsg, key) - case "userId": - err = unpopulate(val, "UserID", &i.UserID) + case "useInApiDocumentation": + err = unpopulate(val, "UseInAPIDocumentation", &o.UseInAPIDocumentation) + delete(rawMsg, key) + case "useInTestConsole": + err = unpopulate(val, "UseInTestConsole", &o.UseInTestConsole) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IssueUpdateContract. -func (i IssueUpdateContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OpenidConnectProviderUpdateContract. +func (o OpenidConnectProviderUpdateContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", i.Properties) + populate(objectMap, "properties", o.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IssueUpdateContract. -func (i *IssueUpdateContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OpenidConnectProviderUpdateContract. +func (o *OpenidConnectProviderUpdateContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { case "properties": - err = unpopulate(val, "Properties", &i.Properties) + err = unpopulate(val, "Properties", &o.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IssueUpdateContractProperties. -func (i IssueUpdateContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OpenidConnectProviderUpdateContractProperties. +func (o OpenidConnectProviderUpdateContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apiId", i.APIID) - populateTimeRFC3339(objectMap, "createdDate", i.CreatedDate) - populate(objectMap, "description", i.Description) - populate(objectMap, "state", i.State) - populate(objectMap, "title", i.Title) - populate(objectMap, "userId", i.UserID) + populate(objectMap, "clientId", o.ClientID) + populate(objectMap, "clientSecret", o.ClientSecret) + populate(objectMap, "description", o.Description) + populate(objectMap, "displayName", o.DisplayName) + populate(objectMap, "metadataEndpoint", o.MetadataEndpoint) + populate(objectMap, "useInApiDocumentation", o.UseInAPIDocumentation) + populate(objectMap, "useInTestConsole", o.UseInTestConsole) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IssueUpdateContractProperties. -func (i *IssueUpdateContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OpenidConnectProviderUpdateContractProperties. +func (o *OpenidConnectProviderUpdateContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "apiId": - err = unpopulate(val, "APIID", &i.APIID) + case "clientId": + err = unpopulate(val, "ClientID", &o.ClientID) delete(rawMsg, key) - case "createdDate": - err = unpopulateTimeRFC3339(val, "CreatedDate", &i.CreatedDate) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &o.ClientSecret) delete(rawMsg, key) case "description": - err = unpopulate(val, "Description", &i.Description) + err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &i.State) + case "displayName": + err = unpopulate(val, "DisplayName", &o.DisplayName) delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &i.Title) + case "metadataEndpoint": + err = unpopulate(val, "MetadataEndpoint", &o.MetadataEndpoint) delete(rawMsg, key) - case "userId": - err = unpopulate(val, "UserID", &i.UserID) + case "useInApiDocumentation": + err = unpopulate(val, "UseInAPIDocumentation", &o.UseInAPIDocumentation) + delete(rawMsg, key) + case "useInTestConsole": + err = unpopulate(val, "UseInTestConsole", &o.UseInTestConsole) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type KeyVaultContractCreateProperties. -func (k KeyVaultContractCreateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identityClientId", k.IdentityClientID) - populate(objectMap, "secretIdentifier", k.SecretIdentifier) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populateAny(objectMap, "properties", o.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultContractCreateProperties. -func (k *KeyVaultContractCreateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "identityClientId": - err = unpopulate(val, "IdentityClientID", &k.IdentityClientID) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) delete(rawMsg, key) - case "secretIdentifier": - err = unpopulate(val, "SecretIdentifier", &k.SecretIdentifier) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type KeyVaultContractProperties. -func (k KeyVaultContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationCollection. +func (o OperationCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identityClientId", k.IdentityClientID) - populate(objectMap, "lastStatus", k.LastStatus) - populate(objectMap, "secretIdentifier", k.SecretIdentifier) + populate(objectMap, "count", o.Count) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultContractProperties. -func (k *KeyVaultContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationCollection. +func (o *OperationCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "identityClientId": - err = unpopulate(val, "IdentityClientID", &k.IdentityClientID) + case "count": + err = unpopulate(val, "Count", &o.Count) delete(rawMsg, key) - case "lastStatus": - err = unpopulate(val, "LastStatus", &k.LastStatus) + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) delete(rawMsg, key) - case "secretIdentifier": - err = unpopulate(val, "SecretIdentifier", &k.SecretIdentifier) + case "value": + err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type KeyVaultLastAccessStatusContractProperties. -func (k KeyVaultLastAccessStatusContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationContract. +func (o OperationContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", k.Code) - populate(objectMap, "message", k.Message) - populateTimeRFC3339(objectMap, "timeStampUtc", k.TimeStampUTC) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "type", o.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultLastAccessStatusContractProperties. -func (k *KeyVaultLastAccessStatusContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationContract. +func (o *OperationContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &k.Code) + case "id": + err = unpopulate(val, "ID", &o.ID) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &k.Message) + case "name": + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) - case "timeStampUtc": - err = unpopulateTimeRFC3339(val, "TimeStampUTC", &k.TimeStampUTC) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LoggerCollection. -func (l LoggerCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationContractProperties. +func (o OperationContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", l.Count) - populate(objectMap, "nextLink", l.NextLink) - populate(objectMap, "value", l.Value) + populate(objectMap, "description", o.Description) + populate(objectMap, "displayName", o.DisplayName) + populate(objectMap, "method", o.Method) + populate(objectMap, "policies", o.Policies) + populate(objectMap, "request", o.Request) + populate(objectMap, "responses", o.Responses) + populate(objectMap, "templateParameters", o.TemplateParameters) + populate(objectMap, "urlTemplate", o.URLTemplate) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LoggerCollection. -func (l *LoggerCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationContractProperties. +func (o *OperationContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &l.Count) + case "description": + err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &l.NextLink) + case "displayName": + err = unpopulate(val, "DisplayName", &o.DisplayName) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &l.Value) + case "method": + err = unpopulate(val, "Method", &o.Method) + delete(rawMsg, key) + case "policies": + err = unpopulate(val, "Policies", &o.Policies) + delete(rawMsg, key) + case "request": + err = unpopulate(val, "Request", &o.Request) + delete(rawMsg, key) + case "responses": + err = unpopulate(val, "Responses", &o.Responses) + delete(rawMsg, key) + case "templateParameters": + err = unpopulate(val, "TemplateParameters", &o.TemplateParameters) + delete(rawMsg, key) + case "urlTemplate": + err = unpopulate(val, "URLTemplate", &o.URLTemplate) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LoggerContract. -func (l LoggerContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", l.ID) - populate(objectMap, "name", l.Name) - populate(objectMap, "properties", l.Properties) - populate(objectMap, "type", l.Type) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LoggerContract. -func (l *LoggerContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &l.ID) + case "description": + err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &l.Name) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &l.Properties) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &l.Type) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LoggerContractProperties. -func (l LoggerContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationEntityBaseContract. +func (o OperationEntityBaseContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "credentials", l.Credentials) - populate(objectMap, "description", l.Description) - populate(objectMap, "isBuffered", l.IsBuffered) - populate(objectMap, "loggerType", l.LoggerType) - populate(objectMap, "resourceId", l.ResourceID) + populate(objectMap, "description", o.Description) + populate(objectMap, "policies", o.Policies) + populate(objectMap, "request", o.Request) + populate(objectMap, "responses", o.Responses) + populate(objectMap, "templateParameters", o.TemplateParameters) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LoggerContractProperties. -func (l *LoggerContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationEntityBaseContract. +func (o *OperationEntityBaseContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "credentials": - err = unpopulate(val, "Credentials", &l.Credentials) - delete(rawMsg, key) case "description": - err = unpopulate(val, "Description", &l.Description) + err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) - case "isBuffered": - err = unpopulate(val, "IsBuffered", &l.IsBuffered) + case "policies": + err = unpopulate(val, "Policies", &o.Policies) delete(rawMsg, key) - case "loggerType": - err = unpopulate(val, "LoggerType", &l.LoggerType) + case "request": + err = unpopulate(val, "Request", &o.Request) delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &l.ResourceID) + case "responses": + err = unpopulate(val, "Responses", &o.Responses) + delete(rawMsg, key) + case "templateParameters": + err = unpopulate(val, "TemplateParameters", &o.TemplateParameters) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LoggerUpdateContract. -func (l LoggerUpdateContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", l.Properties) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LoggerUpdateContract. -func (l *LoggerUpdateContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &l.Properties) + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LoggerUpdateParameters. -func (l LoggerUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationResultContract. +func (o OperationResultContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "credentials", l.Credentials) - populate(objectMap, "description", l.Description) - populate(objectMap, "isBuffered", l.IsBuffered) - populate(objectMap, "loggerType", l.LoggerType) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "type", o.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LoggerUpdateParameters. -func (l *LoggerUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultContract. +func (o *OperationResultContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "credentials": - err = unpopulate(val, "Credentials", &l.Credentials) + case "id": + err = unpopulate(val, "ID", &o.ID) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &l.Description) + case "name": + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) - case "isBuffered": - err = unpopulate(val, "IsBuffered", &l.IsBuffered) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) delete(rawMsg, key) - case "loggerType": - err = unpopulate(val, "LoggerType", &l.LoggerType) + case "type": + err = unpopulate(val, "Type", &o.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NamedValueCollection. -func (n NamedValueCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationResultContractProperties. +func (o OperationResultContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", n.Count) - populate(objectMap, "nextLink", n.NextLink) - populate(objectMap, "value", n.Value) + populate(objectMap, "actionLog", o.ActionLog) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "resultInfo", o.ResultInfo) + populateTimeRFC3339(objectMap, "started", o.Started) + populate(objectMap, "status", o.Status) + populateTimeRFC3339(objectMap, "updated", o.Updated) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueCollection. -func (n *NamedValueCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultContractProperties. +func (o *OperationResultContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &n.Count) + case "actionLog": + err = unpopulate(val, "ActionLog", &o.ActionLog) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &n.NextLink) + case "error": + err = unpopulate(val, "Error", &o.Error) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "resultInfo": + err = unpopulate(val, "ResultInfo", &o.ResultInfo) + delete(rawMsg, key) + case "started": + err = unpopulateTimeRFC3339(val, "Started", &o.Started) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) + delete(rawMsg, key) + case "updated": + err = unpopulateTimeRFC3339(val, "Updated", &o.Updated) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NamedValueContract. -func (n NamedValueContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationResultLogItemContract. +func (o OperationResultLogItemContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", n.ID) - populate(objectMap, "name", n.Name) - populate(objectMap, "properties", n.Properties) - populate(objectMap, "type", n.Type) + populate(objectMap, "action", o.Action) + populate(objectMap, "objectKey", o.ObjectKey) + populate(objectMap, "objectType", o.ObjectType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueContract. -func (n *NamedValueContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultLogItemContract. +func (o *OperationResultLogItemContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &n.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &n.Name) + case "action": + err = unpopulate(val, "Action", &o.Action) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &n.Properties) + case "objectKey": + err = unpopulate(val, "ObjectKey", &o.ObjectKey) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &n.Type) + case "objectType": + err = unpopulate(val, "ObjectType", &o.ObjectType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NamedValueContractProperties. -func (n NamedValueContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationTagResourceContractProperties. +func (o OperationTagResourceContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", n.DisplayName) - populate(objectMap, "keyVault", n.KeyVault) - populate(objectMap, "secret", n.Secret) - populate(objectMap, "tags", n.Tags) - populate(objectMap, "value", n.Value) + populate(objectMap, "apiName", o.APIName) + populate(objectMap, "apiRevision", o.APIRevision) + populate(objectMap, "apiVersion", o.APIVersion) + populate(objectMap, "description", o.Description) + populate(objectMap, "id", o.ID) + populate(objectMap, "method", o.Method) + populate(objectMap, "name", o.Name) + populate(objectMap, "urlTemplate", o.URLTemplate) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueContractProperties. -func (n *NamedValueContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationTagResourceContractProperties. +func (o *OperationTagResourceContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &n.DisplayName) + case "apiName": + err = unpopulate(val, "APIName", &o.APIName) delete(rawMsg, key) - case "keyVault": - err = unpopulate(val, "KeyVault", &n.KeyVault) + case "apiRevision": + err = unpopulate(val, "APIRevision", &o.APIRevision) delete(rawMsg, key) - case "secret": - err = unpopulate(val, "Secret", &n.Secret) + case "apiVersion": + err = unpopulate(val, "APIVersion", &o.APIVersion) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &n.Tags) + case "description": + err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "method": + err = unpopulate(val, "Method", &o.Method) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "urlTemplate": + err = unpopulate(val, "URLTemplate", &o.URLTemplate) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NamedValueCreateContract. -func (n NamedValueCreateContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationUpdateContract. +func (o OperationUpdateContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", n.ID) - populate(objectMap, "name", n.Name) - populate(objectMap, "properties", n.Properties) - populate(objectMap, "type", n.Type) + populate(objectMap, "properties", o.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueCreateContract. -func (n *NamedValueCreateContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationUpdateContract. +func (o *OperationUpdateContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &n.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &n.Name) - delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &n.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &n.Type) + err = unpopulate(val, "Properties", &o.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NamedValueCreateContractProperties. -func (n NamedValueCreateContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationUpdateContractProperties. +func (o OperationUpdateContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", n.DisplayName) - populate(objectMap, "keyVault", n.KeyVault) - populate(objectMap, "secret", n.Secret) - populate(objectMap, "tags", n.Tags) - populate(objectMap, "value", n.Value) + populate(objectMap, "description", o.Description) + populate(objectMap, "displayName", o.DisplayName) + populate(objectMap, "method", o.Method) + populate(objectMap, "policies", o.Policies) + populate(objectMap, "request", o.Request) + populate(objectMap, "responses", o.Responses) + populate(objectMap, "templateParameters", o.TemplateParameters) + populate(objectMap, "urlTemplate", o.URLTemplate) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueCreateContractProperties. -func (n *NamedValueCreateContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationUpdateContractProperties. +func (o *OperationUpdateContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) case "displayName": - err = unpopulate(val, "DisplayName", &n.DisplayName) + err = unpopulate(val, "DisplayName", &o.DisplayName) delete(rawMsg, key) - case "keyVault": - err = unpopulate(val, "KeyVault", &n.KeyVault) + case "method": + err = unpopulate(val, "Method", &o.Method) delete(rawMsg, key) - case "secret": - err = unpopulate(val, "Secret", &n.Secret) + case "policies": + err = unpopulate(val, "Policies", &o.Policies) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &n.Tags) + case "request": + err = unpopulate(val, "Request", &o.Request) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) + case "responses": + err = unpopulate(val, "Responses", &o.Responses) + delete(rawMsg, key) + case "templateParameters": + err = unpopulate(val, "TemplateParameters", &o.TemplateParameters) + delete(rawMsg, key) + case "urlTemplate": + err = unpopulate(val, "URLTemplate", &o.URLTemplate) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NamedValueEntityBaseParameters. -func (n NamedValueEntityBaseParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpoint. +func (o OutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "secret", n.Secret) - populate(objectMap, "tags", n.Tags) + populate(objectMap, "category", o.Category) + populate(objectMap, "endpoints", o.Endpoints) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueEntityBaseParameters. -func (n *NamedValueEntityBaseParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpoint. +func (o *OutboundEnvironmentEndpoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "secret": - err = unpopulate(val, "Secret", &n.Secret) + case "category": + err = unpopulate(val, "Category", &o.Category) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &n.Tags) + case "endpoints": + err = unpopulate(val, "Endpoints", &o.Endpoints) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NamedValueSecretContract. -func (n NamedValueSecretContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpointList. +func (o OutboundEnvironmentEndpointList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", n.Value) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueSecretContract. -func (n *NamedValueSecretContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpointList. +func (o *OutboundEnvironmentEndpointList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &n.Value) + err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NamedValueUpdateParameterProperties. -func (n NamedValueUpdateParameterProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ParameterContract. +func (p ParameterContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", n.DisplayName) - populate(objectMap, "keyVault", n.KeyVault) - populate(objectMap, "secret", n.Secret) - populate(objectMap, "tags", n.Tags) - populate(objectMap, "value", n.Value) + populate(objectMap, "defaultValue", p.DefaultValue) + populate(objectMap, "description", p.Description) + populate(objectMap, "examples", p.Examples) + populate(objectMap, "name", p.Name) + populate(objectMap, "required", p.Required) + populate(objectMap, "schemaId", p.SchemaID) + populate(objectMap, "type", p.Type) + populate(objectMap, "typeName", p.TypeName) + populate(objectMap, "values", p.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueUpdateParameterProperties. -func (n *NamedValueUpdateParameterProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ParameterContract. +func (p *ParameterContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &n.DisplayName) + case "defaultValue": + err = unpopulate(val, "DefaultValue", &p.DefaultValue) delete(rawMsg, key) - case "keyVault": - err = unpopulate(val, "KeyVault", &n.KeyVault) + case "description": + err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) - case "secret": - err = unpopulate(val, "Secret", &n.Secret) + case "examples": + err = unpopulate(val, "Examples", &p.Examples) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &n.Tags) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) + case "required": + err = unpopulate(val, "Required", &p.Required) + delete(rawMsg, key) + case "schemaId": + err = unpopulate(val, "SchemaID", &p.SchemaID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + case "typeName": + err = unpopulate(val, "TypeName", &p.TypeName) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &p.Values) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NamedValueUpdateParameters. -func (n NamedValueUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ParameterExampleContract. +func (p ParameterExampleContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", n.Properties) + populate(objectMap, "description", p.Description) + populate(objectMap, "externalValue", p.ExternalValue) + populate(objectMap, "summary", p.Summary) + populateAny(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NamedValueUpdateParameters. -func (n *NamedValueUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ParameterExampleContract. +func (p *ParameterExampleContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &n.Properties) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "externalValue": + err = unpopulate(val, "ExternalValue", &p.ExternalValue) + delete(rawMsg, key) + case "summary": + err = unpopulate(val, "Summary", &p.Summary) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkStatusContract. -func (n NetworkStatusContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PipelineDiagnosticSettings. +func (p PipelineDiagnosticSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "connectivityStatus", n.ConnectivityStatus) - populate(objectMap, "dnsServers", n.DNSServers) + populate(objectMap, "request", p.Request) + populate(objectMap, "response", p.Response) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkStatusContract. -func (n *NetworkStatusContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineDiagnosticSettings. +func (p *PipelineDiagnosticSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "connectivityStatus": - err = unpopulate(val, "ConnectivityStatus", &n.ConnectivityStatus) + case "request": + err = unpopulate(val, "Request", &p.Request) delete(rawMsg, key) - case "dnsServers": - err = unpopulate(val, "DNSServers", &n.DNSServers) + case "response": + err = unpopulate(val, "Response", &p.Response) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkStatusContractByLocation. -func (n NetworkStatusContractByLocation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyCollection. +func (p PolicyCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "location", n.Location) - populate(objectMap, "networkStatus", n.NetworkStatus) + populate(objectMap, "count", p.Count) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkStatusContractByLocation. -func (n *NetworkStatusContractByLocation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyCollection. +func (p *PolicyCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "location": - err = unpopulate(val, "Location", &n.Location) + case "count": + err = unpopulate(val, "Count", &p.Count) delete(rawMsg, key) - case "networkStatus": - err = unpopulate(val, "NetworkStatus", &n.NetworkStatus) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NotificationCollection. -func (n NotificationCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyContract. +func (p PolicyContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", n.Count) - populate(objectMap, "nextLink", n.NextLink) - populate(objectMap, "value", n.Value) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationCollection. -func (n *NotificationCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyContract. +func (p *PolicyContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &n.Count) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &n.NextLink) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NotificationContract. -func (n NotificationContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyContractProperties. +func (p PolicyContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", n.ID) - populate(objectMap, "name", n.Name) - populate(objectMap, "properties", n.Properties) - populate(objectMap, "type", n.Type) + populate(objectMap, "format", p.Format) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationContract. -func (n *NotificationContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyContractProperties. +func (p *PolicyContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &n.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &n.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &n.Properties) + case "format": + err = unpopulate(val, "Format", &p.Format) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &n.Type) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NotificationContractProperties. -func (n NotificationContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyDescriptionCollection. +func (p PolicyDescriptionCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", n.Description) - populate(objectMap, "recipients", n.Recipients) - populate(objectMap, "title", n.Title) + populate(objectMap, "count", p.Count) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationContractProperties. -func (n *NotificationContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyDescriptionCollection. +func (p *PolicyDescriptionCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &n.Description) - delete(rawMsg, key) - case "recipients": - err = unpopulate(val, "Recipients", &n.Recipients) + case "count": + err = unpopulate(val, "Count", &p.Count) delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &n.Title) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OAuth2AuthenticationSettingsContract. -func (o OAuth2AuthenticationSettingsContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyDescriptionContract. +func (p PolicyDescriptionContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "authorizationServerId", o.AuthorizationServerID) - populate(objectMap, "scope", o.Scope) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OAuth2AuthenticationSettingsContract. -func (o *OAuth2AuthenticationSettingsContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyDescriptionContract. +func (p *PolicyDescriptionContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "authorizationServerId": - err = unpopulate(val, "AuthorizationServerID", &o.AuthorizationServerID) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &o.Scope) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OpenIDAuthenticationSettingsContract. -func (o OpenIDAuthenticationSettingsContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyDescriptionContractProperties. +func (p PolicyDescriptionContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "bearerTokenSendingMethods", o.BearerTokenSendingMethods) - populate(objectMap, "openidProviderId", o.OpenidProviderID) + populate(objectMap, "description", p.Description) + populate(objectMap, "scope", p.Scope) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OpenIDAuthenticationSettingsContract. -func (o *OpenIDAuthenticationSettingsContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyDescriptionContractProperties. +func (p *PolicyDescriptionContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "bearerTokenSendingMethods": - err = unpopulate(val, "BearerTokenSendingMethods", &o.BearerTokenSendingMethods) + case "description": + err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) - case "openidProviderId": - err = unpopulate(val, "OpenidProviderID", &o.OpenidProviderID) + case "scope": + err = unpopulate(val, "Scope", &p.Scope) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OpenIDConnectProviderCollection. -func (o OpenIDConnectProviderCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyFragmentCollection. +func (p PolicyFragmentCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", o.Count) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "count", p.Count) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OpenIDConnectProviderCollection. -func (o *OpenIDConnectProviderCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyFragmentCollection. +func (p *PolicyFragmentCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "count": - err = unpopulate(val, "Count", &o.Count) + err = unpopulate(val, "Count", &p.Count) delete(rawMsg, key) case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &o.Value) + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OpenidConnectProviderContract. -func (o OpenidConnectProviderContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyFragmentContract. +func (p PolicyFragmentContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", o.ID) - populate(objectMap, "name", o.Name) - populate(objectMap, "properties", o.Properties) - populate(objectMap, "type", o.Type) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OpenidConnectProviderContract. -func (o *OpenidConnectProviderContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyFragmentContract. +func (p *PolicyFragmentContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &o.ID) + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &o.Name) + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &o.Properties) + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &o.Type) + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OpenidConnectProviderContractProperties. -func (o OpenidConnectProviderContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyFragmentContractProperties. +func (p PolicyFragmentContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientId", o.ClientID) - populate(objectMap, "clientSecret", o.ClientSecret) - populate(objectMap, "description", o.Description) - populate(objectMap, "displayName", o.DisplayName) - populate(objectMap, "metadataEndpoint", o.MetadataEndpoint) + populate(objectMap, "description", p.Description) + populate(objectMap, "format", p.Format) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OpenidConnectProviderContractProperties. -func (o *OpenidConnectProviderContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyFragmentContractProperties. +func (p *PolicyFragmentContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "clientId": - err = unpopulate(val, "ClientID", &o.ClientID) - delete(rawMsg, key) - case "clientSecret": - err = unpopulate(val, "ClientSecret", &o.ClientSecret) - delete(rawMsg, key) case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &o.DisplayName) + err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) - case "metadataEndpoint": - err = unpopulate(val, "MetadataEndpoint", &o.MetadataEndpoint) + case "format": + err = unpopulate(val, "Format", &p.Format) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OpenidConnectProviderUpdateContract. -func (o OpenidConnectProviderUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", o.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OpenidConnectProviderUpdateContract. -func (o *OpenidConnectProviderUpdateContract) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, "Properties", &o.Properties) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OpenidConnectProviderUpdateContractProperties. -func (o OpenidConnectProviderUpdateContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalConfigCollection. +func (p PortalConfigCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientId", o.ClientID) - populate(objectMap, "clientSecret", o.ClientSecret) - populate(objectMap, "description", o.Description) - populate(objectMap, "displayName", o.DisplayName) - populate(objectMap, "metadataEndpoint", o.MetadataEndpoint) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OpenidConnectProviderUpdateContractProperties. -func (o *OpenidConnectProviderUpdateContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalConfigCollection. +func (p *PortalConfigCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "clientId": - err = unpopulate(val, "ClientID", &o.ClientID) - delete(rawMsg, key) - case "clientSecret": - err = unpopulate(val, "ClientSecret", &o.ClientSecret) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &o.DisplayName) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "metadataEndpoint": - err = unpopulate(val, "MetadataEndpoint", &o.MetadataEndpoint) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalConfigContract. +func (p PortalConfigContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) - populateAny(objectMap, "properties", o.Properties) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalConfigContract. +func (p *PortalConfigContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "display": - err = unpopulate(val, "Display", &o.Display) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &o.Properties) + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationCollection. -func (o OperationCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalConfigCorsProperties. +func (p PortalConfigCorsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", o.Count) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "allowedOrigins", p.AllowedOrigins) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationCollection. -func (o *OperationCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalConfigCorsProperties. +func (p *PortalConfigCorsProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &o.Count) - delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) + case "allowedOrigins": + err = unpopulate(val, "AllowedOrigins", &p.AllowedOrigins) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationContract. -func (o OperationContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalConfigCspProperties. +func (p PortalConfigCspProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", o.ID) - populate(objectMap, "name", o.Name) - populate(objectMap, "properties", o.Properties) - populate(objectMap, "type", o.Type) + populate(objectMap, "allowedSources", p.AllowedSources) + populate(objectMap, "mode", p.Mode) + populate(objectMap, "reportUri", p.ReportURI) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationContract. -func (o *OperationContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalConfigCspProperties. +func (p *PortalConfigCspProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) + case "allowedSources": + err = unpopulate(val, "AllowedSources", &p.AllowedSources) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) + case "mode": + err = unpopulate(val, "Mode", &p.Mode) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &o.Type) + case "reportUri": + err = unpopulate(val, "ReportURI", &p.ReportURI) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } - -// MarshalJSON implements the json.Marshaller interface for type OperationContractProperties. -func (o OperationContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "displayName", o.DisplayName) - populate(objectMap, "method", o.Method) - populate(objectMap, "policies", o.Policies) - populate(objectMap, "request", o.Request) - populate(objectMap, "responses", o.Responses) - populate(objectMap, "templateParameters", o.TemplateParameters) - populate(objectMap, "urlTemplate", o.URLTemplate) + +// MarshalJSON implements the json.Marshaller interface for type PortalConfigDelegationProperties. +func (p PortalConfigDelegationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "delegateRegistration", p.DelegateRegistration) + populate(objectMap, "delegateSubscription", p.DelegateSubscription) + populate(objectMap, "delegationUrl", p.DelegationURL) + populate(objectMap, "validationKey", p.ValidationKey) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationContractProperties. -func (o *OperationContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalConfigDelegationProperties. +func (p *PortalConfigDelegationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &o.DisplayName) - delete(rawMsg, key) - case "method": - err = unpopulate(val, "Method", &o.Method) - delete(rawMsg, key) - case "policies": - err = unpopulate(val, "Policies", &o.Policies) - delete(rawMsg, key) - case "request": - err = unpopulate(val, "Request", &o.Request) + case "delegateRegistration": + err = unpopulate(val, "DelegateRegistration", &p.DelegateRegistration) delete(rawMsg, key) - case "responses": - err = unpopulate(val, "Responses", &o.Responses) + case "delegateSubscription": + err = unpopulate(val, "DelegateSubscription", &p.DelegateSubscription) delete(rawMsg, key) - case "templateParameters": - err = unpopulate(val, "TemplateParameters", &o.TemplateParameters) + case "delegationUrl": + err = unpopulate(val, "DelegationURL", &p.DelegationURL) delete(rawMsg, key) - case "urlTemplate": - err = unpopulate(val, "URLTemplate", &o.URLTemplate) + case "validationKey": + err = unpopulate(val, "ValidationKey", &p.ValidationKey) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalConfigProperties. +func (p PortalConfigProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) + populate(objectMap, "cors", p.Cors) + populate(objectMap, "csp", p.Csp) + populate(objectMap, "delegation", p.Delegation) + populate(objectMap, "enableBasicAuth", p.EnableBasicAuth) + populate(objectMap, "signin", p.Signin) + populate(objectMap, "signup", p.Signup) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalConfigProperties. +func (p *PortalConfigProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) + case "cors": + err = unpopulate(val, "Cors", &p.Cors) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) + case "csp": + err = unpopulate(val, "Csp", &p.Csp) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) + case "delegation": + err = unpopulate(val, "Delegation", &p.Delegation) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "enableBasicAuth": + err = unpopulate(val, "EnableBasicAuth", &p.EnableBasicAuth) + delete(rawMsg, key) + case "signin": + err = unpopulate(val, "Signin", &p.Signin) + delete(rawMsg, key) + case "signup": + err = unpopulate(val, "Signup", &p.Signup) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationEntityBaseContract. -func (o OperationEntityBaseContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalConfigPropertiesSignin. +func (p PortalConfigPropertiesSignin) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "policies", o.Policies) - populate(objectMap, "request", o.Request) - populate(objectMap, "responses", o.Responses) - populate(objectMap, "templateParameters", o.TemplateParameters) + populate(objectMap, "require", p.Require) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationEntityBaseContract. -func (o *OperationEntityBaseContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalConfigPropertiesSignin. +func (p *PortalConfigPropertiesSignin) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "policies": - err = unpopulate(val, "Policies", &o.Policies) - delete(rawMsg, key) - case "request": - err = unpopulate(val, "Request", &o.Request) - delete(rawMsg, key) - case "responses": - err = unpopulate(val, "Responses", &o.Responses) - delete(rawMsg, key) - case "templateParameters": - err = unpopulate(val, "TemplateParameters", &o.TemplateParameters) + case "require": + err = unpopulate(val, "Require", &p.Require) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalConfigPropertiesSignup. +func (p PortalConfigPropertiesSignup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "termsOfService", p.TermsOfService) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalConfigPropertiesSignup. +func (p *PortalConfigPropertiesSignup) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) + case "termsOfService": + err = unpopulate(val, "TermsOfService", &p.TermsOfService) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationResultContract. -func (o OperationResultContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalConfigTermsOfServiceProperties. +func (p PortalConfigTermsOfServiceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", o.ID) - populate(objectMap, "name", o.Name) - populate(objectMap, "properties", o.Properties) - populate(objectMap, "type", o.Type) + populate(objectMap, "requireConsent", p.RequireConsent) + populate(objectMap, "text", p.Text) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultContract. -func (o *OperationResultContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalConfigTermsOfServiceProperties. +func (p *PortalConfigTermsOfServiceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) + case "requireConsent": + err = unpopulate(val, "RequireConsent", &p.RequireConsent) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &o.Type) + case "text": + err = unpopulate(val, "Text", &p.Text) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationResultContractProperties. -func (o OperationResultContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalDelegationSettings. +func (p PortalDelegationSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionLog", o.ActionLog) - populate(objectMap, "error", o.Error) - populate(objectMap, "id", o.ID) - populate(objectMap, "resultInfo", o.ResultInfo) - populateTimeRFC3339(objectMap, "started", o.Started) - populate(objectMap, "status", o.Status) - populateTimeRFC3339(objectMap, "updated", o.Updated) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultContractProperties. -func (o *OperationResultContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalDelegationSettings. +func (p *PortalDelegationSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "actionLog": - err = unpopulate(val, "ActionLog", &o.ActionLog) - delete(rawMsg, key) - case "error": - err = unpopulate(val, "Error", &o.Error) - delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "resultInfo": - err = unpopulate(val, "ResultInfo", &o.ResultInfo) + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "started": - err = unpopulateTimeRFC3339(val, "Started", &o.Started) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &o.Status) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) - case "updated": - err = unpopulateTimeRFC3339(val, "Updated", &o.Updated) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationResultLogItemContract. -func (o OperationResultLogItemContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalDelegationSettingsProperties. +func (p PortalDelegationSettingsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "action", o.Action) - populate(objectMap, "objectKey", o.ObjectKey) - populate(objectMap, "objectType", o.ObjectType) + populate(objectMap, "subscriptions", p.Subscriptions) + populate(objectMap, "url", p.URL) + populate(objectMap, "userRegistration", p.UserRegistration) + populate(objectMap, "validationKey", p.ValidationKey) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultLogItemContract. -func (o *OperationResultLogItemContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalDelegationSettingsProperties. +func (p *PortalDelegationSettingsProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "action": - err = unpopulate(val, "Action", &o.Action) + case "subscriptions": + err = unpopulate(val, "Subscriptions", &p.Subscriptions) delete(rawMsg, key) - case "objectKey": - err = unpopulate(val, "ObjectKey", &o.ObjectKey) + case "url": + err = unpopulate(val, "URL", &p.URL) delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &o.ObjectType) + case "userRegistration": + err = unpopulate(val, "UserRegistration", &p.UserRegistration) + delete(rawMsg, key) + case "validationKey": + err = unpopulate(val, "ValidationKey", &p.ValidationKey) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationTagResourceContractProperties. -func (o OperationTagResourceContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalRevisionCollection. +func (p PortalRevisionCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apiName", o.APIName) - populate(objectMap, "apiRevision", o.APIRevision) - populate(objectMap, "apiVersion", o.APIVersion) - populate(objectMap, "description", o.Description) - populate(objectMap, "id", o.ID) - populate(objectMap, "method", o.Method) - populate(objectMap, "name", o.Name) - populate(objectMap, "urlTemplate", o.URLTemplate) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationTagResourceContractProperties. -func (o *OperationTagResourceContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalRevisionCollection. +func (p *PortalRevisionCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "apiName": - err = unpopulate(val, "APIName", &o.APIName) - delete(rawMsg, key) - case "apiRevision": - err = unpopulate(val, "APIRevision", &o.APIRevision) - delete(rawMsg, key) - case "apiVersion": - err = unpopulate(val, "APIVersion", &o.APIVersion) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "method": - err = unpopulate(val, "Method", &o.Method) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "urlTemplate": - err = unpopulate(val, "URLTemplate", &o.URLTemplate) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationUpdateContract. -func (o OperationUpdateContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalRevisionContract. +func (p PortalRevisionContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", o.Properties) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationUpdateContract. -func (o *OperationUpdateContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalRevisionContract. +func (p *PortalRevisionContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &o.Properties) + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationUpdateContractProperties. -func (o OperationUpdateContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalRevisionContractProperties. +func (p PortalRevisionContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "displayName", o.DisplayName) - populate(objectMap, "method", o.Method) - populate(objectMap, "policies", o.Policies) - populate(objectMap, "request", o.Request) - populate(objectMap, "responses", o.Responses) - populate(objectMap, "templateParameters", o.TemplateParameters) - populate(objectMap, "urlTemplate", o.URLTemplate) + populateTimeRFC3339(objectMap, "createdDateTime", p.CreatedDateTime) + populate(objectMap, "description", p.Description) + populate(objectMap, "isCurrent", p.IsCurrent) + populate(objectMap, "status", p.Status) + populate(objectMap, "statusDetails", p.StatusDetails) + populateTimeRFC3339(objectMap, "updatedDateTime", p.UpdatedDateTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationUpdateContractProperties. -func (o *OperationUpdateContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalRevisionContractProperties. +func (p *PortalRevisionContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &o.DisplayName) - delete(rawMsg, key) - case "method": - err = unpopulate(val, "Method", &o.Method) + case "createdDateTime": + err = unpopulateTimeRFC3339(val, "CreatedDateTime", &p.CreatedDateTime) delete(rawMsg, key) - case "policies": - err = unpopulate(val, "Policies", &o.Policies) + case "description": + err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) - case "request": - err = unpopulate(val, "Request", &o.Request) + case "isCurrent": + err = unpopulate(val, "IsCurrent", &p.IsCurrent) delete(rawMsg, key) - case "responses": - err = unpopulate(val, "Responses", &o.Responses) + case "status": + err = unpopulate(val, "Status", &p.Status) delete(rawMsg, key) - case "templateParameters": - err = unpopulate(val, "TemplateParameters", &o.TemplateParameters) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &p.StatusDetails) delete(rawMsg, key) - case "urlTemplate": - err = unpopulate(val, "URLTemplate", &o.URLTemplate) + case "updatedDateTime": + err = unpopulateTimeRFC3339(val, "UpdatedDateTime", &p.UpdatedDateTime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpoint. -func (o OutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalSettingValidationKeyContract. +func (p PortalSettingValidationKeyContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "category", o.Category) - populate(objectMap, "endpoints", o.Endpoints) + populate(objectMap, "validationKey", p.ValidationKey) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpoint. -func (o *OutboundEnvironmentEndpoint) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSettingValidationKeyContract. +func (p *PortalSettingValidationKeyContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "category": - err = unpopulate(val, "Category", &o.Category) - delete(rawMsg, key) - case "endpoints": - err = unpopulate(val, "Endpoints", &o.Endpoints) + case "validationKey": + err = unpopulate(val, "ValidationKey", &p.ValidationKey) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpointList. -func (o OutboundEnvironmentEndpointList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalSettingsCollection. +func (p PortalSettingsCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "count", p.Count) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpointList. -func (o *OutboundEnvironmentEndpointList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSettingsCollection. +func (p *PortalSettingsCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + case "count": + err = unpopulate(val, "Count", &p.Count) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &o.Value) + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ParameterContract. -func (p ParameterContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalSettingsContract. +func (p PortalSettingsContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "defaultValue", p.DefaultValue) - populate(objectMap, "description", p.Description) - populate(objectMap, "examples", p.Examples) + populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) - populate(objectMap, "required", p.Required) - populate(objectMap, "schemaId", p.SchemaID) + populate(objectMap, "properties", p.Properties) populate(objectMap, "type", p.Type) - populate(objectMap, "typeName", p.TypeName) - populate(objectMap, "values", p.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ParameterContract. -func (p *ParameterContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSettingsContract. +func (p *PortalSettingsContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8005,33 +9992,18 @@ func (p *ParameterContract) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "defaultValue": - err = unpopulate(val, "DefaultValue", &p.DefaultValue) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "examples": - err = unpopulate(val, "Examples", &p.Examples) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "required": - err = unpopulate(val, "Required", &p.Required) - delete(rawMsg, key) - case "schemaId": - err = unpopulate(val, "SchemaID", &p.SchemaID) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) - case "typeName": - err = unpopulate(val, "TypeName", &p.TypeName) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &p.Values) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8040,18 +10012,20 @@ func (p *ParameterContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ParameterExampleContract. -func (p ParameterExampleContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalSettingsContractProperties. +func (p PortalSettingsContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", p.Description) - populate(objectMap, "externalValue", p.ExternalValue) - populate(objectMap, "summary", p.Summary) - populateAny(objectMap, "value", p.Value) + populate(objectMap, "enabled", p.Enabled) + populate(objectMap, "subscriptions", p.Subscriptions) + populate(objectMap, "termsOfService", p.TermsOfService) + populate(objectMap, "url", p.URL) + populate(objectMap, "userRegistration", p.UserRegistration) + populate(objectMap, "validationKey", p.ValidationKey) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ParameterExampleContract. -func (p *ParameterExampleContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSettingsContractProperties. +func (p *PortalSettingsContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8059,17 +10033,23 @@ func (p *ParameterExampleContract) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &p.Description) + case "enabled": + err = unpopulate(val, "Enabled", &p.Enabled) delete(rawMsg, key) - case "externalValue": - err = unpopulate(val, "ExternalValue", &p.ExternalValue) + case "subscriptions": + err = unpopulate(val, "Subscriptions", &p.Subscriptions) delete(rawMsg, key) - case "summary": - err = unpopulate(val, "Summary", &p.Summary) + case "termsOfService": + err = unpopulate(val, "TermsOfService", &p.TermsOfService) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "url": + err = unpopulate(val, "URL", &p.URL) + delete(rawMsg, key) + case "userRegistration": + err = unpopulate(val, "UserRegistration", &p.UserRegistration) + delete(rawMsg, key) + case "validationKey": + err = unpopulate(val, "ValidationKey", &p.ValidationKey) delete(rawMsg, key) } if err != nil { @@ -8079,16 +10059,15 @@ func (p *ParameterExampleContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PipelineDiagnosticSettings. -func (p PipelineDiagnosticSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalSigninSettingProperties. +func (p PortalSigninSettingProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "request", p.Request) - populate(objectMap, "response", p.Response) + populate(objectMap, "enabled", p.Enabled) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineDiagnosticSettings. -func (p *PipelineDiagnosticSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSigninSettingProperties. +func (p *PortalSigninSettingProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8096,11 +10075,8 @@ func (p *PipelineDiagnosticSettings) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "request": - err = unpopulate(val, "Request", &p.Request) - delete(rawMsg, key) - case "response": - err = unpopulate(val, "Response", &p.Response) + case "enabled": + err = unpopulate(val, "Enabled", &p.Enabled) delete(rawMsg, key) } if err != nil { @@ -8110,17 +10086,18 @@ func (p *PipelineDiagnosticSettings) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyCollection. -func (p PolicyCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalSigninSettings. +func (p PortalSigninSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", p.Count) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyCollection. -func (p *PolicyCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSigninSettings. +func (p *PortalSigninSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8128,14 +10105,17 @@ func (p *PolicyCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &p.Count) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { @@ -8145,8 +10125,8 @@ func (p *PolicyCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyContract. -func (p PolicyContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalSignupSettings. +func (p PortalSignupSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) @@ -8154,9 +10134,9 @@ func (p PolicyContract) MarshalJSON() ([]byte, error) { populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } - -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyContract. -func (p *PolicyContract) UnmarshalJSON(data []byte) error { + +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSignupSettings. +func (p *PortalSignupSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8184,16 +10164,16 @@ func (p *PolicyContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyContractProperties. -func (p PolicyContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PortalSignupSettingsProperties. +func (p PortalSignupSettingsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "format", p.Format) - populate(objectMap, "value", p.Value) + populate(objectMap, "enabled", p.Enabled) + populate(objectMap, "termsOfService", p.TermsOfService) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyContractProperties. -func (p *PolicyContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSignupSettingsProperties. +func (p *PortalSignupSettingsProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8201,11 +10181,11 @@ func (p *PolicyContractProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "format": - err = unpopulate(val, "Format", &p.Format) + case "enabled": + err = unpopulate(val, "Enabled", &p.Enabled) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "termsOfService": + err = unpopulate(val, "TermsOfService", &p.TermsOfService) delete(rawMsg, key) } if err != nil { @@ -8215,16 +10195,15 @@ func (p *PolicyContractProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyDescriptionCollection. -func (p PolicyDescriptionCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", p.Count) - populate(objectMap, "value", p.Value) + populate(objectMap, "id", p.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyDescriptionCollection. -func (p *PolicyDescriptionCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8232,11 +10211,8 @@ func (p *PolicyDescriptionCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &p.Count) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) } if err != nil { @@ -8246,8 +10222,8 @@ func (p *PolicyDescriptionCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyDescriptionContract. -func (p PolicyDescriptionContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) @@ -8256,8 +10232,8 @@ func (p PolicyDescriptionContract) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyDescriptionContract. -func (p *PolicyDescriptionContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8285,16 +10261,15 @@ func (p *PolicyDescriptionContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyDescriptionContractProperties. -func (p PolicyDescriptionContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", p.Description) - populate(objectMap, "scope", p.Scope) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyDescriptionContractProperties. -func (p *PolicyDescriptionContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8302,11 +10277,8 @@ func (p *PolicyDescriptionContractProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &p.Scope) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { @@ -8316,18 +10288,17 @@ func (p *PolicyDescriptionContractProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PortalDelegationSettings. -func (p PortalDelegationSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PortalDelegationSettings. -func (p *PortalDelegationSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8335,17 +10306,14 @@ func (p *PortalDelegationSettings) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) } if err != nil { @@ -8355,18 +10323,16 @@ func (p *PortalDelegationSettings) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PortalDelegationSettingsProperties. -func (p PortalDelegationSettingsProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionRequest. +func (p PrivateEndpointConnectionRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "subscriptions", p.Subscriptions) - populate(objectMap, "url", p.URL) - populate(objectMap, "userRegistration", p.UserRegistration) - populate(objectMap, "validationKey", p.ValidationKey) + populate(objectMap, "id", p.ID) + populate(objectMap, "properties", p.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PortalDelegationSettingsProperties. -func (p *PortalDelegationSettingsProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionRequest. +func (p *PrivateEndpointConnectionRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8374,17 +10340,11 @@ func (p *PortalDelegationSettingsProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "subscriptions": - err = unpopulate(val, "Subscriptions", &p.Subscriptions) - delete(rawMsg, key) - case "url": - err = unpopulate(val, "URL", &p.URL) - delete(rawMsg, key) - case "userRegistration": - err = unpopulate(val, "UserRegistration", &p.UserRegistration) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "validationKey": - err = unpopulate(val, "ValidationKey", &p.ValidationKey) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) } if err != nil { @@ -8394,16 +10354,15 @@ func (p *PortalDelegationSettingsProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PortalRevisionCollection. -func (p PortalRevisionCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionRequestProperties. +func (p PrivateEndpointConnectionRequestProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PortalRevisionCollection. -func (p *PortalRevisionCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionRequestProperties. +func (p *PrivateEndpointConnectionRequestProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8411,11 +10370,8 @@ func (p *PortalRevisionCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) delete(rawMsg, key) } if err != nil { @@ -8425,18 +10381,18 @@ func (p *PortalRevisionCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PortalRevisionContract. -func (p PortalRevisionContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionWrapperProperties. +func (p PrivateEndpointConnectionWrapperProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PortalRevisionContract. -func (p *PortalRevisionContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionWrapperProperties. +func (p *PrivateEndpointConnectionWrapperProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8444,17 +10400,17 @@ func (p *PortalRevisionContract) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) } if err != nil { @@ -8464,20 +10420,18 @@ func (p *PortalRevisionContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PortalRevisionContractProperties. -func (p PortalRevisionContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdDateTime", p.CreatedDateTime) - populate(objectMap, "description", p.Description) - populate(objectMap, "isCurrent", p.IsCurrent) - populate(objectMap, "status", p.Status) - populate(objectMap, "statusDetails", p.StatusDetails) - populateTimeRFC3339(objectMap, "updatedDateTime", p.UpdatedDateTime) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PortalRevisionContractProperties. -func (p *PortalRevisionContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8485,50 +10439,17 @@ func (p *PortalRevisionContractProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createdDateTime": - err = unpopulateTimeRFC3339(val, "CreatedDateTime", &p.CreatedDateTime) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "isCurrent": - err = unpopulate(val, "IsCurrent", &p.IsCurrent) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "statusDetails": - err = unpopulate(val, "StatusDetails", &p.StatusDetails) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "updatedDateTime": - err = unpopulateTimeRFC3339(val, "UpdatedDateTime", &p.UpdatedDateTime) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PortalSettingValidationKeyContract. -func (p PortalSettingValidationKeyContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "validationKey", p.ValidationKey) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSettingValidationKeyContract. -func (p *PortalSettingValidationKeyContract) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "validationKey": - err = unpopulate(val, "ValidationKey", &p.ValidationKey) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { @@ -8538,26 +10459,22 @@ func (p *PortalSettingValidationKeyContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PortalSettingsCollection. -func (p PortalSettingsCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", p.Count) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSettingsCollection. -func (p *PortalSettingsCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { - var err error - switch key { - case "count": - err = unpopulate(val, "Count", &p.Count) - delete(rawMsg, key) + var err error + switch key { case "value": err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) @@ -8569,18 +10486,17 @@ func (p *PortalSettingsCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PortalSettingsContract. -func (p PortalSettingsContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSettingsContract. -func (p *PortalSettingsContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8588,17 +10504,14 @@ func (p *PortalSettingsContract) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) delete(rawMsg, key) } if err != nil { @@ -8608,20 +10521,17 @@ func (p *PortalSettingsContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PortalSettingsContractProperties. -func (p PortalSettingsContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", p.Enabled) - populate(objectMap, "subscriptions", p.Subscriptions) - populate(objectMap, "termsOfService", p.TermsOfService) - populate(objectMap, "url", p.URL) - populate(objectMap, "userRegistration", p.UserRegistration) - populate(objectMap, "validationKey", p.ValidationKey) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSettingsContractProperties. -func (p *PortalSettingsContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8629,23 +10539,14 @@ func (p *PortalSettingsContractProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &p.Enabled) - delete(rawMsg, key) - case "subscriptions": - err = unpopulate(val, "Subscriptions", &p.Subscriptions) - delete(rawMsg, key) - case "termsOfService": - err = unpopulate(val, "TermsOfService", &p.TermsOfService) - delete(rawMsg, key) - case "url": - err = unpopulate(val, "URL", &p.URL) + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) delete(rawMsg, key) - case "userRegistration": - err = unpopulate(val, "UserRegistration", &p.UserRegistration) + case "description": + err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) - case "validationKey": - err = unpopulate(val, "ValidationKey", &p.ValidationKey) + case "status": + err = unpopulate(val, "Status", &p.Status) delete(rawMsg, key) } if err != nil { @@ -8655,15 +10556,17 @@ func (p *PortalSettingsContractProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PortalSigninSettingProperties. -func (p PortalSigninSettingProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductAPILinkCollection. +func (p ProductAPILinkCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", p.Enabled) + populate(objectMap, "count", p.Count) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSigninSettingProperties. -func (p *PortalSigninSettingProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductAPILinkCollection. +func (p *ProductAPILinkCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8671,8 +10574,14 @@ func (p *PortalSigninSettingProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &p.Enabled) + case "count": + err = unpopulate(val, "Count", &p.Count) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { @@ -8682,8 +10591,8 @@ func (p *PortalSigninSettingProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PortalSigninSettings. -func (p PortalSigninSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductAPILinkContract. +func (p ProductAPILinkContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) @@ -8692,8 +10601,8 @@ func (p PortalSigninSettings) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSigninSettings. -func (p *PortalSigninSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductAPILinkContract. +func (p *ProductAPILinkContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8721,18 +10630,15 @@ func (p *PortalSigninSettings) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PortalSignupSettings. -func (p PortalSignupSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductAPILinkContractProperties. +func (p ProductAPILinkContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) + populate(objectMap, "apiId", p.APIID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSignupSettings. -func (p *PortalSignupSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductAPILinkContractProperties. +func (p *ProductAPILinkContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8740,17 +10646,8 @@ func (p *PortalSignupSettings) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "apiId": + err = unpopulate(val, "APIID", &p.APIID) delete(rawMsg, key) } if err != nil { @@ -8760,16 +10657,17 @@ func (p *PortalSignupSettings) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PortalSignupSettingsProperties. -func (p PortalSignupSettingsProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductCollection. +func (p ProductCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", p.Enabled) - populate(objectMap, "termsOfService", p.TermsOfService) + populate(objectMap, "count", p.Count) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PortalSignupSettingsProperties. -func (p *PortalSignupSettingsProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductCollection. +func (p *ProductCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8777,11 +10675,14 @@ func (p *PortalSignupSettingsProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &p.Enabled) + case "count": + err = unpopulate(val, "Count", &p.Count) delete(rawMsg, key) - case "termsOfService": - err = unpopulate(val, "TermsOfService", &p.TermsOfService) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { @@ -8791,15 +10692,18 @@ func (p *PortalSignupSettingsProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. -func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductContract. +func (p ProductContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. -func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductContract. +func (p *ProductContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8810,6 +10714,15 @@ func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8818,18 +10731,21 @@ func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. -func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductContractProperties. +func (p ProductContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) + populate(objectMap, "approvalRequired", p.ApprovalRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "state", p.State) + populate(objectMap, "subscriptionRequired", p.SubscriptionRequired) + populate(objectMap, "subscriptionsLimit", p.SubscriptionsLimit) + populate(objectMap, "terms", p.Terms) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. -func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductContractProperties. +func (p *ProductContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8837,17 +10753,26 @@ func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) + case "approvalRequired": + err = unpopulate(val, "ApprovalRequired", &p.ApprovalRequired) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "description": + err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + case "subscriptionRequired": + err = unpopulate(val, "SubscriptionRequired", &p.SubscriptionRequired) + delete(rawMsg, key) + case "subscriptionsLimit": + err = unpopulate(val, "SubscriptionsLimit", &p.SubscriptionsLimit) + delete(rawMsg, key) + case "terms": + err = unpopulate(val, "Terms", &p.Terms) delete(rawMsg, key) } if err != nil { @@ -8857,15 +10782,20 @@ func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. -func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductEntityBaseParameters. +func (p ProductEntityBaseParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", p.Value) + populate(objectMap, "approvalRequired", p.ApprovalRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "state", p.State) + populate(objectMap, "subscriptionRequired", p.SubscriptionRequired) + populate(objectMap, "subscriptionsLimit", p.SubscriptionsLimit) + populate(objectMap, "terms", p.Terms) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. -func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductEntityBaseParameters. +func (p *ProductEntityBaseParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8873,8 +10803,23 @@ func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &p.Value) + case "approvalRequired": + err = unpopulate(val, "ApprovalRequired", &p.ApprovalRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + case "subscriptionRequired": + err = unpopulate(val, "SubscriptionRequired", &p.SubscriptionRequired) + delete(rawMsg, key) + case "subscriptionsLimit": + err = unpopulate(val, "SubscriptionsLimit", &p.SubscriptionsLimit) + delete(rawMsg, key) + case "terms": + err = unpopulate(val, "Terms", &p.Terms) delete(rawMsg, key) } if err != nil { @@ -8884,17 +10829,17 @@ func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. -func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductGroupLinkCollection. +func (p ProductGroupLinkCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "privateEndpoint", p.PrivateEndpoint) - populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) - populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "count", p.Count) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. -func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductGroupLinkCollection. +func (p *ProductGroupLinkCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8902,14 +10847,14 @@ func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "privateEndpoint": - err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + case "count": + err = unpopulate(val, "Count", &p.Count) delete(rawMsg, key) - case "privateLinkServiceConnectionState": - err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { @@ -8919,16 +10864,18 @@ func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionRequest. -func (p PrivateEndpointConnectionRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductGroupLinkContract. +func (p ProductGroupLinkContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionRequest. -func (p *PrivateEndpointConnectionRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductGroupLinkContract. +func (p *ProductGroupLinkContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8939,9 +10886,15 @@ func (p *PrivateEndpointConnectionRequest) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8950,15 +10903,15 @@ func (p *PrivateEndpointConnectionRequest) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionRequestProperties. -func (p PrivateEndpointConnectionRequestProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductGroupLinkContractProperties. +func (p ProductGroupLinkContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "groupId", p.GroupID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionRequestProperties. -func (p *PrivateEndpointConnectionRequestProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductGroupLinkContractProperties. +func (p *ProductGroupLinkContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8966,8 +10919,8 @@ func (p *PrivateEndpointConnectionRequestProperties) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "privateLinkServiceConnectionState": - err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) delete(rawMsg, key) } if err != nil { @@ -8977,18 +10930,22 @@ func (p *PrivateEndpointConnectionRequestProperties) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionWrapperProperties. -func (p PrivateEndpointConnectionWrapperProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductTagResourceContractProperties. +func (p ProductTagResourceContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "groupIds", p.GroupIDs) - populate(objectMap, "privateEndpoint", p.PrivateEndpoint) - populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) - populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "approvalRequired", p.ApprovalRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "state", p.State) + populate(objectMap, "subscriptionRequired", p.SubscriptionRequired) + populate(objectMap, "subscriptionsLimit", p.SubscriptionsLimit) + populate(objectMap, "terms", p.Terms) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionWrapperProperties. -func (p *PrivateEndpointConnectionWrapperProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductTagResourceContractProperties. +func (p *ProductTagResourceContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8996,17 +10953,29 @@ func (p *PrivateEndpointConnectionWrapperProperties) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "groupIds": - err = unpopulate(val, "GroupIDs", &p.GroupIDs) + case "approvalRequired": + err = unpopulate(val, "ApprovalRequired", &p.ApprovalRequired) delete(rawMsg, key) - case "privateEndpoint": - err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + case "description": + err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) - case "privateLinkServiceConnectionState": - err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + case "subscriptionRequired": + err = unpopulate(val, "SubscriptionRequired", &p.SubscriptionRequired) + delete(rawMsg, key) + case "subscriptionsLimit": + err = unpopulate(val, "SubscriptionsLimit", &p.SubscriptionsLimit) + delete(rawMsg, key) + case "terms": + err = unpopulate(val, "Terms", &p.Terms) delete(rawMsg, key) } if err != nil { @@ -9016,18 +10985,15 @@ func (p *PrivateEndpointConnectionWrapperProperties) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. -func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductUpdateParameters. +func (p ProductUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. -func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductUpdateParameters. +func (p *ProductUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -9035,18 +11001,9 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -9055,15 +11012,21 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. -func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductUpdateProperties. +func (p ProductUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", p.Value) + populate(objectMap, "approvalRequired", p.ApprovalRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "state", p.State) + populate(objectMap, "subscriptionRequired", p.SubscriptionRequired) + populate(objectMap, "subscriptionsLimit", p.SubscriptionsLimit) + populate(objectMap, "terms", p.Terms) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. -func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductUpdateProperties. +func (p *ProductUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -9071,8 +11034,26 @@ func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &p.Value) + case "approvalRequired": + err = unpopulate(val, "ApprovalRequired", &p.ApprovalRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + case "subscriptionRequired": + err = unpopulate(val, "SubscriptionRequired", &p.SubscriptionRequired) + delete(rawMsg, key) + case "subscriptionsLimit": + err = unpopulate(val, "SubscriptionsLimit", &p.SubscriptionsLimit) + delete(rawMsg, key) + case "terms": + err = unpopulate(val, "Terms", &p.Terms) delete(rawMsg, key) } if err != nil { @@ -9082,17 +11063,17 @@ func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. -func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -9100,14 +11081,14 @@ func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "groupId": - err = unpopulate(val, "GroupID", &p.GroupID) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "requiredMembers": - err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "requiredZoneNames": - err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { @@ -9117,511 +11098,439 @@ func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. -func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type QuotaCounterCollection. +func (q QuotaCounterCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionsRequired", p.ActionsRequired) - populate(objectMap, "description", p.Description) - populate(objectMap, "status", p.Status) + populate(objectMap, "count", q.Count) + populate(objectMap, "nextLink", q.NextLink) + populate(objectMap, "value", q.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. -func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaCounterCollection. +func (q *QuotaCounterCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } for key, val := range rawMsg { var err error switch key { - case "actionsRequired": - err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + case "count": + err = unpopulate(val, "Count", &q.Count) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) + case "nextLink": + err = unpopulate(val, "NextLink", &q.NextLink) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) + case "value": + err = unpopulate(val, "Value", &q.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProductCollection. -func (p ProductCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type QuotaCounterContract. +func (q QuotaCounterContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", p.Count) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "counterKey", q.CounterKey) + populateTimeRFC3339(objectMap, "periodEndTime", q.PeriodEndTime) + populate(objectMap, "periodKey", q.PeriodKey) + populateTimeRFC3339(objectMap, "periodStartTime", q.PeriodStartTime) + populate(objectMap, "value", q.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProductCollection. -func (p *ProductCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaCounterContract. +func (q *QuotaCounterContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &p.Count) + case "counterKey": + err = unpopulate(val, "CounterKey", &q.CounterKey) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "periodEndTime": + err = unpopulateTimeRFC3339(val, "PeriodEndTime", &q.PeriodEndTime) + delete(rawMsg, key) + case "periodKey": + err = unpopulate(val, "PeriodKey", &q.PeriodKey) + delete(rawMsg, key) + case "periodStartTime": + err = unpopulateTimeRFC3339(val, "PeriodStartTime", &q.PeriodStartTime) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &p.Value) + err = unpopulate(val, "Value", &q.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProductContract. -func (p ProductContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type QuotaCounterValueContract. +func (q QuotaCounterValueContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) + populate(objectMap, "value", q.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProductContract. -func (p *ProductContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaCounterValueContract. +func (q *QuotaCounterValueContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "value": + err = unpopulate(val, "Value", &q.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProductContractProperties. -func (p ProductContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "approvalRequired", p.ApprovalRequired) - populate(objectMap, "description", p.Description) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "state", p.State) - populate(objectMap, "subscriptionRequired", p.SubscriptionRequired) - populate(objectMap, "subscriptionsLimit", p.SubscriptionsLimit) - populate(objectMap, "terms", p.Terms) +// MarshalJSON implements the json.Marshaller interface for type QuotaCounterValueContractProperties. +func (q QuotaCounterValueContractProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "callsCount", q.CallsCount) + populate(objectMap, "kbTransferred", q.KbTransferred) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProductContractProperties. -func (p *ProductContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaCounterValueContractProperties. +func (q *QuotaCounterValueContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } for key, val := range rawMsg { var err error switch key { - case "approvalRequired": - err = unpopulate(val, "ApprovalRequired", &p.ApprovalRequired) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) - delete(rawMsg, key) - case "subscriptionRequired": - err = unpopulate(val, "SubscriptionRequired", &p.SubscriptionRequired) - delete(rawMsg, key) - case "subscriptionsLimit": - err = unpopulate(val, "SubscriptionsLimit", &p.SubscriptionsLimit) + case "callsCount": + err = unpopulate(val, "CallsCount", &q.CallsCount) delete(rawMsg, key) - case "terms": - err = unpopulate(val, "Terms", &p.Terms) + case "kbTransferred": + err = unpopulate(val, "KbTransferred", &q.KbTransferred) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProductEntityBaseParameters. -func (p ProductEntityBaseParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type QuotaCounterValueUpdateContract. +func (q QuotaCounterValueUpdateContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "approvalRequired", p.ApprovalRequired) - populate(objectMap, "description", p.Description) - populate(objectMap, "state", p.State) - populate(objectMap, "subscriptionRequired", p.SubscriptionRequired) - populate(objectMap, "subscriptionsLimit", p.SubscriptionsLimit) - populate(objectMap, "terms", p.Terms) + populate(objectMap, "properties", q.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProductEntityBaseParameters. -func (p *ProductEntityBaseParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaCounterValueUpdateContract. +func (q *QuotaCounterValueUpdateContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } for key, val := range rawMsg { var err error switch key { - case "approvalRequired": - err = unpopulate(val, "ApprovalRequired", &p.ApprovalRequired) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) - delete(rawMsg, key) - case "subscriptionRequired": - err = unpopulate(val, "SubscriptionRequired", &p.SubscriptionRequired) - delete(rawMsg, key) - case "subscriptionsLimit": - err = unpopulate(val, "SubscriptionsLimit", &p.SubscriptionsLimit) - delete(rawMsg, key) - case "terms": - err = unpopulate(val, "Terms", &p.Terms) + case "properties": + err = unpopulate(val, "Properties", &q.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProductTagResourceContractProperties. -func (p ProductTagResourceContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecipientEmailCollection. +func (r RecipientEmailCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "approvalRequired", p.ApprovalRequired) - populate(objectMap, "description", p.Description) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "state", p.State) - populate(objectMap, "subscriptionRequired", p.SubscriptionRequired) - populate(objectMap, "subscriptionsLimit", p.SubscriptionsLimit) - populate(objectMap, "terms", p.Terms) + populate(objectMap, "count", r.Count) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProductTagResourceContractProperties. -func (p *ProductTagResourceContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecipientEmailCollection. +func (r *RecipientEmailCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "approvalRequired": - err = unpopulate(val, "ApprovalRequired", &p.ApprovalRequired) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) - delete(rawMsg, key) - case "subscriptionRequired": - err = unpopulate(val, "SubscriptionRequired", &p.SubscriptionRequired) + case "count": + err = unpopulate(val, "Count", &r.Count) delete(rawMsg, key) - case "subscriptionsLimit": - err = unpopulate(val, "SubscriptionsLimit", &p.SubscriptionsLimit) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) delete(rawMsg, key) - case "terms": - err = unpopulate(val, "Terms", &p.Terms) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProductUpdateParameters. -func (p ProductUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecipientEmailContract. +func (r RecipientEmailContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", p.Properties) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProductUpdateParameters. -func (p *ProductUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecipientEmailContract. +func (r *RecipientEmailContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &p.Properties) + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProductUpdateProperties. -func (p ProductUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecipientEmailContractProperties. +func (r RecipientEmailContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "approvalRequired", p.ApprovalRequired) - populate(objectMap, "description", p.Description) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "state", p.State) - populate(objectMap, "subscriptionRequired", p.SubscriptionRequired) - populate(objectMap, "subscriptionsLimit", p.SubscriptionsLimit) - populate(objectMap, "terms", p.Terms) + populate(objectMap, "email", r.Email) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProductUpdateProperties. -func (p *ProductUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecipientEmailContractProperties. +func (r *RecipientEmailContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "approvalRequired": - err = unpopulate(val, "ApprovalRequired", &p.ApprovalRequired) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) - delete(rawMsg, key) - case "subscriptionRequired": - err = unpopulate(val, "SubscriptionRequired", &p.SubscriptionRequired) - delete(rawMsg, key) - case "subscriptionsLimit": - err = unpopulate(val, "SubscriptionsLimit", &p.SubscriptionsLimit) - delete(rawMsg, key) - case "terms": - err = unpopulate(val, "Terms", &p.Terms) + case "email": + err = unpopulate(val, "Email", &r.Email) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QuotaCounterCollection. -func (q QuotaCounterCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecipientUserCollection. +func (r RecipientUserCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", q.Count) - populate(objectMap, "nextLink", q.NextLink) - populate(objectMap, "value", q.Value) + populate(objectMap, "count", r.Count) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaCounterCollection. -func (q *QuotaCounterCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecipientUserCollection. +func (r *RecipientUserCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { case "count": - err = unpopulate(val, "Count", &q.Count) + err = unpopulate(val, "Count", &r.Count) delete(rawMsg, key) case "nextLink": - err = unpopulate(val, "NextLink", &q.NextLink) + err = unpopulate(val, "NextLink", &r.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &q.Value) + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QuotaCounterContract. -func (q QuotaCounterContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecipientUserContract. +func (r RecipientUserContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "counterKey", q.CounterKey) - populateTimeRFC3339(objectMap, "periodEndTime", q.PeriodEndTime) - populate(objectMap, "periodKey", q.PeriodKey) - populateTimeRFC3339(objectMap, "periodStartTime", q.PeriodStartTime) - populate(objectMap, "value", q.Value) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaCounterContract. -func (q *QuotaCounterContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecipientUserContract. +func (r *RecipientUserContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "counterKey": - err = unpopulate(val, "CounterKey", &q.CounterKey) - delete(rawMsg, key) - case "periodEndTime": - err = unpopulateTimeRFC3339(val, "PeriodEndTime", &q.PeriodEndTime) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "periodKey": - err = unpopulate(val, "PeriodKey", &q.PeriodKey) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "periodStartTime": - err = unpopulateTimeRFC3339(val, "PeriodStartTime", &q.PeriodStartTime) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &q.Value) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QuotaCounterValueContract. -func (q QuotaCounterValueContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecipientUsersContractProperties. +func (r RecipientUsersContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", q.Value) + populate(objectMap, "userId", r.UserID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaCounterValueContract. -func (q *QuotaCounterValueContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecipientUsersContractProperties. +func (r *RecipientUsersContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &q.Value) + case "userId": + err = unpopulate(val, "UserID", &r.UserID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QuotaCounterValueContractProperties. -func (q QuotaCounterValueContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecipientsContractProperties. +func (r RecipientsContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "callsCount", q.CallsCount) - populate(objectMap, "kbTransferred", q.KbTransferred) + populate(objectMap, "emails", r.Emails) + populate(objectMap, "users", r.Users) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaCounterValueContractProperties. -func (q *QuotaCounterValueContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecipientsContractProperties. +func (r *RecipientsContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "callsCount": - err = unpopulate(val, "CallsCount", &q.CallsCount) + case "emails": + err = unpopulate(val, "Emails", &r.Emails) delete(rawMsg, key) - case "kbTransferred": - err = unpopulate(val, "KbTransferred", &q.KbTransferred) + case "users": + err = unpopulate(val, "Users", &r.Users) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QuotaCounterValueUpdateContract. -func (q QuotaCounterValueUpdateContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegionContract. +func (r RegionContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", q.Properties) + populate(objectMap, "isDeleted", r.IsDeleted) + populate(objectMap, "isMasterRegion", r.IsMasterRegion) + populate(objectMap, "name", r.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaCounterValueUpdateContract. -func (q *QuotaCounterValueUpdateContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegionContract. +func (r *RegionContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &q.Properties) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &r.IsDeleted) + delete(rawMsg, key) + case "isMasterRegion": + err = unpopulate(val, "IsMasterRegion", &r.IsMasterRegion) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RecipientEmailCollection. -func (r RecipientEmailCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegionListResult. +func (r RegionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "count", r.Count) populate(objectMap, "nextLink", r.NextLink) @@ -9629,8 +11538,8 @@ func (r RecipientEmailCollection) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecipientEmailCollection. -func (r *RecipientEmailCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegionListResult. +func (r *RegionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -9655,8 +11564,35 @@ func (r *RecipientEmailCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecipientEmailContract. -func (r RecipientEmailContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegistrationDelegationSettingsProperties. +func (r RegistrationDelegationSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", r.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistrationDelegationSettingsProperties. +func (r *RegistrationDelegationSettingsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &r.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RemotePrivateEndpointConnectionWrapper. +func (r RemotePrivateEndpointConnectionWrapper) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) @@ -9665,8 +11601,8 @@ func (r RecipientEmailContract) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecipientEmailContract. -func (r *RecipientEmailContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RemotePrivateEndpointConnectionWrapper. +func (r *RemotePrivateEndpointConnectionWrapper) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -9694,15 +11630,17 @@ func (r *RecipientEmailContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecipientEmailContractProperties. -func (r RecipientEmailContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReportCollection. +func (r ReportCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "email", r.Email) + populate(objectMap, "count", r.Count) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecipientEmailContractProperties. -func (r *RecipientEmailContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportCollection. +func (r *ReportCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -9710,8 +11648,141 @@ func (r *RecipientEmailContractProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "email": - err = unpopulate(val, "Email", &r.Email) + case "count": + err = unpopulate(val, "Count", &r.Count) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReportRecordContract. +func (r ReportRecordContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apiId", r.APIID) + populate(objectMap, "apiRegion", r.APIRegion) + populate(objectMap, "apiTimeAvg", r.APITimeAvg) + populate(objectMap, "apiTimeMax", r.APITimeMax) + populate(objectMap, "apiTimeMin", r.APITimeMin) + populate(objectMap, "bandwidth", r.Bandwidth) + populate(objectMap, "cacheHitCount", r.CacheHitCount) + populate(objectMap, "cacheMissCount", r.CacheMissCount) + populate(objectMap, "callCountBlocked", r.CallCountBlocked) + populate(objectMap, "callCountFailed", r.CallCountFailed) + populate(objectMap, "callCountOther", r.CallCountOther) + populate(objectMap, "callCountSuccess", r.CallCountSuccess) + populate(objectMap, "callCountTotal", r.CallCountTotal) + populate(objectMap, "country", r.Country) + populate(objectMap, "interval", r.Interval) + populate(objectMap, "name", r.Name) + populate(objectMap, "operationId", r.OperationID) + populate(objectMap, "productId", r.ProductID) + populate(objectMap, "region", r.Region) + populate(objectMap, "serviceTimeAvg", r.ServiceTimeAvg) + populate(objectMap, "serviceTimeMax", r.ServiceTimeMax) + populate(objectMap, "serviceTimeMin", r.ServiceTimeMin) + populate(objectMap, "subscriptionId", r.SubscriptionID) + populateTimeRFC3339(objectMap, "timestamp", r.Timestamp) + populate(objectMap, "userId", r.UserID) + populate(objectMap, "zip", r.Zip) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportRecordContract. +func (r *ReportRecordContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiId": + err = unpopulate(val, "APIID", &r.APIID) + delete(rawMsg, key) + case "apiRegion": + err = unpopulate(val, "APIRegion", &r.APIRegion) + delete(rawMsg, key) + case "apiTimeAvg": + err = unpopulate(val, "APITimeAvg", &r.APITimeAvg) + delete(rawMsg, key) + case "apiTimeMax": + err = unpopulate(val, "APITimeMax", &r.APITimeMax) + delete(rawMsg, key) + case "apiTimeMin": + err = unpopulate(val, "APITimeMin", &r.APITimeMin) + delete(rawMsg, key) + case "bandwidth": + err = unpopulate(val, "Bandwidth", &r.Bandwidth) + delete(rawMsg, key) + case "cacheHitCount": + err = unpopulate(val, "CacheHitCount", &r.CacheHitCount) + delete(rawMsg, key) + case "cacheMissCount": + err = unpopulate(val, "CacheMissCount", &r.CacheMissCount) + delete(rawMsg, key) + case "callCountBlocked": + err = unpopulate(val, "CallCountBlocked", &r.CallCountBlocked) + delete(rawMsg, key) + case "callCountFailed": + err = unpopulate(val, "CallCountFailed", &r.CallCountFailed) + delete(rawMsg, key) + case "callCountOther": + err = unpopulate(val, "CallCountOther", &r.CallCountOther) + delete(rawMsg, key) + case "callCountSuccess": + err = unpopulate(val, "CallCountSuccess", &r.CallCountSuccess) + delete(rawMsg, key) + case "callCountTotal": + err = unpopulate(val, "CallCountTotal", &r.CallCountTotal) + delete(rawMsg, key) + case "country": + err = unpopulate(val, "Country", &r.Country) + delete(rawMsg, key) + case "interval": + err = unpopulate(val, "Interval", &r.Interval) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "operationId": + err = unpopulate(val, "OperationID", &r.OperationID) + delete(rawMsg, key) + case "productId": + err = unpopulate(val, "ProductID", &r.ProductID) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &r.Region) + delete(rawMsg, key) + case "serviceTimeAvg": + err = unpopulate(val, "ServiceTimeAvg", &r.ServiceTimeAvg) + delete(rawMsg, key) + case "serviceTimeMax": + err = unpopulate(val, "ServiceTimeMax", &r.ServiceTimeMax) + delete(rawMsg, key) + case "serviceTimeMin": + err = unpopulate(val, "ServiceTimeMin", &r.ServiceTimeMin) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &r.SubscriptionID) + delete(rawMsg, key) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &r.Timestamp) + delete(rawMsg, key) + case "userId": + err = unpopulate(val, "UserID", &r.UserID) + delete(rawMsg, key) + case "zip": + err = unpopulate(val, "Zip", &r.Zip) delete(rawMsg, key) } if err != nil { @@ -9721,17 +11792,19 @@ func (r *RecipientEmailContractProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecipientUserCollection. -func (r RecipientUserCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RepresentationContract. +func (r RepresentationContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", r.Count) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "contentType", r.ContentType) + populate(objectMap, "examples", r.Examples) + populate(objectMap, "formParameters", r.FormParameters) + populate(objectMap, "schemaId", r.SchemaID) + populate(objectMap, "typeName", r.TypeName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecipientUserCollection. -func (r *RecipientUserCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RepresentationContract. +func (r *RepresentationContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -9739,14 +11812,20 @@ func (r *RecipientUserCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &r.Count) + case "contentType": + err = unpopulate(val, "ContentType", &r.ContentType) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + case "examples": + err = unpopulate(val, "Examples", &r.Examples) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "formParameters": + err = unpopulate(val, "FormParameters", &r.FormParameters) + delete(rawMsg, key) + case "schemaId": + err = unpopulate(val, "SchemaID", &r.SchemaID) + delete(rawMsg, key) + case "typeName": + err = unpopulate(val, "TypeName", &r.TypeName) delete(rawMsg, key) } if err != nil { @@ -9756,18 +11835,18 @@ func (r *RecipientUserCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecipientUserContract. -func (r RecipientUserContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RequestContract. +func (r RequestContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) + populate(objectMap, "description", r.Description) + populate(objectMap, "headers", r.Headers) + populate(objectMap, "queryParameters", r.QueryParameters) + populate(objectMap, "representations", r.Representations) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecipientUserContract. -func (r *RecipientUserContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestContract. +func (r *RequestContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -9775,17 +11854,17 @@ func (r *RecipientUserContract) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) + case "description": + err = unpopulate(val, "Description", &r.Description) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "headers": + err = unpopulate(val, "Headers", &r.Headers) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) + case "queryParameters": + err = unpopulate(val, "QueryParameters", &r.QueryParameters) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "representations": + err = unpopulate(val, "Representations", &r.Representations) delete(rawMsg, key) } if err != nil { @@ -9795,15 +11874,16 @@ func (r *RecipientUserContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecipientUsersContractProperties. -func (r RecipientUsersContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RequestReportCollection. +func (r RequestReportCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "userId", r.UserID) + populate(objectMap, "count", r.Count) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecipientUsersContractProperties. -func (r *RecipientUsersContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestReportCollection. +func (r *RequestReportCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -9811,8 +11891,11 @@ func (r *RecipientUsersContractProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "userId": - err = unpopulate(val, "UserID", &r.UserID) + case "count": + err = unpopulate(val, "Count", &r.Count) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -9822,16 +11905,32 @@ func (r *RecipientUsersContractProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecipientsContractProperties. -func (r RecipientsContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RequestReportRecordContract. +func (r RequestReportRecordContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "emails", r.Emails) - populate(objectMap, "users", r.Users) + populate(objectMap, "apiId", r.APIID) + populate(objectMap, "apiRegion", r.APIRegion) + populate(objectMap, "apiTime", r.APITime) + populate(objectMap, "backendResponseCode", r.BackendResponseCode) + populate(objectMap, "cache", r.Cache) + populate(objectMap, "ipAddress", r.IPAddress) + populate(objectMap, "method", r.Method) + populate(objectMap, "operationId", r.OperationID) + populate(objectMap, "productId", r.ProductID) + populate(objectMap, "requestId", r.RequestID) + populate(objectMap, "requestSize", r.RequestSize) + populate(objectMap, "responseCode", r.ResponseCode) + populate(objectMap, "responseSize", r.ResponseSize) + populate(objectMap, "serviceTime", r.ServiceTime) + populate(objectMap, "subscriptionId", r.SubscriptionID) + populateTimeRFC3339(objectMap, "timestamp", r.Timestamp) + populate(objectMap, "url", r.URL) + populate(objectMap, "userId", r.UserID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecipientsContractProperties. -func (r *RecipientsContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestReportRecordContract. +func (r *RequestReportRecordContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -9839,11 +11938,59 @@ func (r *RecipientsContractProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "emails": - err = unpopulate(val, "Emails", &r.Emails) + case "apiId": + err = unpopulate(val, "APIID", &r.APIID) delete(rawMsg, key) - case "users": - err = unpopulate(val, "Users", &r.Users) + case "apiRegion": + err = unpopulate(val, "APIRegion", &r.APIRegion) + delete(rawMsg, key) + case "apiTime": + err = unpopulate(val, "APITime", &r.APITime) + delete(rawMsg, key) + case "backendResponseCode": + err = unpopulate(val, "BackendResponseCode", &r.BackendResponseCode) + delete(rawMsg, key) + case "cache": + err = unpopulate(val, "Cache", &r.Cache) + delete(rawMsg, key) + case "ipAddress": + err = unpopulate(val, "IPAddress", &r.IPAddress) + delete(rawMsg, key) + case "method": + err = unpopulate(val, "Method", &r.Method) + delete(rawMsg, key) + case "operationId": + err = unpopulate(val, "OperationID", &r.OperationID) + delete(rawMsg, key) + case "productId": + err = unpopulate(val, "ProductID", &r.ProductID) + delete(rawMsg, key) + case "requestId": + err = unpopulate(val, "RequestID", &r.RequestID) + delete(rawMsg, key) + case "requestSize": + err = unpopulate(val, "RequestSize", &r.RequestSize) + delete(rawMsg, key) + case "responseCode": + err = unpopulate(val, "ResponseCode", &r.ResponseCode) + delete(rawMsg, key) + case "responseSize": + err = unpopulate(val, "ResponseSize", &r.ResponseSize) + delete(rawMsg, key) + case "serviceTime": + err = unpopulate(val, "ServiceTime", &r.ServiceTime) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &r.SubscriptionID) + delete(rawMsg, key) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &r.Timestamp) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &r.URL) + delete(rawMsg, key) + case "userId": + err = unpopulate(val, "UserID", &r.UserID) delete(rawMsg, key) } if err != nil { @@ -9853,17 +12000,17 @@ func (r *RecipientsContractProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RegionContract. -func (r RegionContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResolverCollection. +func (r ResolverCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "isDeleted", r.IsDeleted) - populate(objectMap, "isMasterRegion", r.IsMasterRegion) - populate(objectMap, "name", r.Name) + populate(objectMap, "count", r.Count) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RegionContract. -func (r *RegionContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResolverCollection. +func (r *ResolverCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -9871,14 +12018,14 @@ func (r *RegionContract) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "isDeleted": - err = unpopulate(val, "IsDeleted", &r.IsDeleted) + case "count": + err = unpopulate(val, "Count", &r.Count) delete(rawMsg, key) - case "isMasterRegion": - err = unpopulate(val, "IsMasterRegion", &r.IsMasterRegion) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -9888,17 +12035,18 @@ func (r *RegionContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RegionListResult. -func (r RegionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResolverContract. +func (r ResolverContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", r.Count) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RegionListResult. -func (r *RegionListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResolverContract. +func (r *ResolverContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -9906,14 +12054,17 @@ func (r *RegionListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &r.Count) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { @@ -9923,15 +12074,17 @@ func (r *RegionListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RegistrationDelegationSettingsProperties. -func (r RegistrationDelegationSettingsProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResolverEntityBaseContract. +func (r ResolverEntityBaseContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", r.Enabled) + populate(objectMap, "description", r.Description) + populate(objectMap, "displayName", r.DisplayName) + populate(objectMap, "path", r.Path) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RegistrationDelegationSettingsProperties. -func (r *RegistrationDelegationSettingsProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResolverEntityBaseContract. +func (r *ResolverEntityBaseContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -9939,8 +12092,14 @@ func (r *RegistrationDelegationSettingsProperties) UnmarshalJSON(data []byte) er for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &r.Enabled) + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &r.DisplayName) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &r.Path) delete(rawMsg, key) } if err != nil { @@ -9950,8 +12109,8 @@ func (r *RegistrationDelegationSettingsProperties) UnmarshalJSON(data []byte) er return nil } -// MarshalJSON implements the json.Marshaller interface for type RemotePrivateEndpointConnectionWrapper. -func (r RemotePrivateEndpointConnectionWrapper) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResolverResultContract. +func (r ResolverResultContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) @@ -9960,8 +12119,8 @@ func (r RemotePrivateEndpointConnectionWrapper) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RemotePrivateEndpointConnectionWrapper. -func (r *RemotePrivateEndpointConnectionWrapper) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResolverResultContract. +func (r *ResolverResultContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -9989,17 +12148,21 @@ func (r *RemotePrivateEndpointConnectionWrapper) UnmarshalJSON(data []byte) erro return nil } -// MarshalJSON implements the json.Marshaller interface for type ReportCollection. -func (r ReportCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResolverResultContractProperties. +func (r ResolverResultContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", r.Count) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "actionLog", r.ActionLog) + populate(objectMap, "error", r.Error) + populate(objectMap, "id", r.ID) + populate(objectMap, "resultInfo", r.ResultInfo) + populateTimeRFC3339(objectMap, "started", r.Started) + populate(objectMap, "status", r.Status) + populateTimeRFC3339(objectMap, "updated", r.Updated) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReportCollection. -func (r *ReportCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResolverResultContractProperties. +func (r *ResolverResultContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -10007,14 +12170,26 @@ func (r *ReportCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &r.Count) + case "actionLog": + err = unpopulate(val, "ActionLog", &r.ActionLog) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &r.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + case "resultInfo": + err = unpopulate(val, "ResultInfo", &r.ResultInfo) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "started": + err = unpopulateTimeRFC3339(val, "Started", &r.Started) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "updated": + err = unpopulateTimeRFC3339(val, "Updated", &r.Updated) delete(rawMsg, key) } if err != nil { @@ -10024,40 +12199,17 @@ func (r *ReportCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ReportRecordContract. -func (r ReportRecordContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResolverResultLogItemContract. +func (r ResolverResultLogItemContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apiId", r.APIID) - populate(objectMap, "apiRegion", r.APIRegion) - populate(objectMap, "apiTimeAvg", r.APITimeAvg) - populate(objectMap, "apiTimeMax", r.APITimeMax) - populate(objectMap, "apiTimeMin", r.APITimeMin) - populate(objectMap, "bandwidth", r.Bandwidth) - populate(objectMap, "cacheHitCount", r.CacheHitCount) - populate(objectMap, "cacheMissCount", r.CacheMissCount) - populate(objectMap, "callCountBlocked", r.CallCountBlocked) - populate(objectMap, "callCountFailed", r.CallCountFailed) - populate(objectMap, "callCountOther", r.CallCountOther) - populate(objectMap, "callCountSuccess", r.CallCountSuccess) - populate(objectMap, "callCountTotal", r.CallCountTotal) - populate(objectMap, "country", r.Country) - populate(objectMap, "interval", r.Interval) - populate(objectMap, "name", r.Name) - populate(objectMap, "operationId", r.OperationID) - populate(objectMap, "productId", r.ProductID) - populate(objectMap, "region", r.Region) - populate(objectMap, "serviceTimeAvg", r.ServiceTimeAvg) - populate(objectMap, "serviceTimeMax", r.ServiceTimeMax) - populate(objectMap, "serviceTimeMin", r.ServiceTimeMin) - populate(objectMap, "subscriptionId", r.SubscriptionID) - populateTimeRFC3339(objectMap, "timestamp", r.Timestamp) - populate(objectMap, "userId", r.UserID) - populate(objectMap, "zip", r.Zip) + populate(objectMap, "action", r.Action) + populate(objectMap, "objectKey", r.ObjectKey) + populate(objectMap, "objectType", r.ObjectType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReportRecordContract. -func (r *ReportRecordContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResolverResultLogItemContract. +func (r *ResolverResultLogItemContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -10065,83 +12217,14 @@ func (r *ReportRecordContract) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "apiId": - err = unpopulate(val, "APIID", &r.APIID) - delete(rawMsg, key) - case "apiRegion": - err = unpopulate(val, "APIRegion", &r.APIRegion) - delete(rawMsg, key) - case "apiTimeAvg": - err = unpopulate(val, "APITimeAvg", &r.APITimeAvg) - delete(rawMsg, key) - case "apiTimeMax": - err = unpopulate(val, "APITimeMax", &r.APITimeMax) - delete(rawMsg, key) - case "apiTimeMin": - err = unpopulate(val, "APITimeMin", &r.APITimeMin) - delete(rawMsg, key) - case "bandwidth": - err = unpopulate(val, "Bandwidth", &r.Bandwidth) - delete(rawMsg, key) - case "cacheHitCount": - err = unpopulate(val, "CacheHitCount", &r.CacheHitCount) - delete(rawMsg, key) - case "cacheMissCount": - err = unpopulate(val, "CacheMissCount", &r.CacheMissCount) - delete(rawMsg, key) - case "callCountBlocked": - err = unpopulate(val, "CallCountBlocked", &r.CallCountBlocked) - delete(rawMsg, key) - case "callCountFailed": - err = unpopulate(val, "CallCountFailed", &r.CallCountFailed) - delete(rawMsg, key) - case "callCountOther": - err = unpopulate(val, "CallCountOther", &r.CallCountOther) - delete(rawMsg, key) - case "callCountSuccess": - err = unpopulate(val, "CallCountSuccess", &r.CallCountSuccess) - delete(rawMsg, key) - case "callCountTotal": - err = unpopulate(val, "CallCountTotal", &r.CallCountTotal) - delete(rawMsg, key) - case "country": - err = unpopulate(val, "Country", &r.Country) - delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &r.Interval) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "operationId": - err = unpopulate(val, "OperationID", &r.OperationID) - delete(rawMsg, key) - case "productId": - err = unpopulate(val, "ProductID", &r.ProductID) - delete(rawMsg, key) - case "region": - err = unpopulate(val, "Region", &r.Region) - delete(rawMsg, key) - case "serviceTimeAvg": - err = unpopulate(val, "ServiceTimeAvg", &r.ServiceTimeAvg) - delete(rawMsg, key) - case "serviceTimeMax": - err = unpopulate(val, "ServiceTimeMax", &r.ServiceTimeMax) - delete(rawMsg, key) - case "serviceTimeMin": - err = unpopulate(val, "ServiceTimeMin", &r.ServiceTimeMin) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &r.SubscriptionID) - delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &r.Timestamp) + case "action": + err = unpopulate(val, "Action", &r.Action) delete(rawMsg, key) - case "userId": - err = unpopulate(val, "UserID", &r.UserID) + case "objectKey": + err = unpopulate(val, "ObjectKey", &r.ObjectKey) delete(rawMsg, key) - case "zip": - err = unpopulate(val, "Zip", &r.Zip) + case "objectType": + err = unpopulate(val, "ObjectType", &r.ObjectType) delete(rawMsg, key) } if err != nil { @@ -10151,19 +12234,15 @@ func (r *ReportRecordContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RepresentationContract. -func (r RepresentationContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResolverUpdateContract. +func (r ResolverUpdateContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "contentType", r.ContentType) - populate(objectMap, "examples", r.Examples) - populate(objectMap, "formParameters", r.FormParameters) - populate(objectMap, "schemaId", r.SchemaID) - populate(objectMap, "typeName", r.TypeName) + populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RepresentationContract. -func (r *RepresentationContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResolverUpdateContract. +func (r *ResolverUpdateContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -10171,20 +12250,8 @@ func (r *RepresentationContract) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "contentType": - err = unpopulate(val, "ContentType", &r.ContentType) - delete(rawMsg, key) - case "examples": - err = unpopulate(val, "Examples", &r.Examples) - delete(rawMsg, key) - case "formParameters": - err = unpopulate(val, "FormParameters", &r.FormParameters) - delete(rawMsg, key) - case "schemaId": - err = unpopulate(val, "SchemaID", &r.SchemaID) - delete(rawMsg, key) - case "typeName": - err = unpopulate(val, "TypeName", &r.TypeName) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) } if err != nil { @@ -10194,18 +12261,17 @@ func (r *RepresentationContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RequestContract. -func (r RequestContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResolverUpdateContractProperties. +func (r ResolverUpdateContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "description", r.Description) - populate(objectMap, "headers", r.Headers) - populate(objectMap, "queryParameters", r.QueryParameters) - populate(objectMap, "representations", r.Representations) + populate(objectMap, "displayName", r.DisplayName) + populate(objectMap, "path", r.Path) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RequestContract. -func (r *RequestContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResolverUpdateContractProperties. +func (r *ResolverUpdateContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -10216,14 +12282,11 @@ func (r *RequestContract) UnmarshalJSON(data []byte) error { case "description": err = unpopulate(val, "Description", &r.Description) delete(rawMsg, key) - case "headers": - err = unpopulate(val, "Headers", &r.Headers) - delete(rawMsg, key) - case "queryParameters": - err = unpopulate(val, "QueryParameters", &r.QueryParameters) + case "displayName": + err = unpopulate(val, "DisplayName", &r.DisplayName) delete(rawMsg, key) - case "representations": - err = unpopulate(val, "Representations", &r.Representations) + case "path": + err = unpopulate(val, "Path", &r.Path) delete(rawMsg, key) } if err != nil { @@ -10233,16 +12296,17 @@ func (r *RequestContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RequestReportCollection. -func (r RequestReportCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", r.Count) - populate(objectMap, "value", r.Value) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RequestReportCollection. -func (r *RequestReportCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -10250,11 +12314,14 @@ func (r *RequestReportCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &r.Count) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { @@ -10264,32 +12331,17 @@ func (r *RequestReportCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RequestReportRecordContract. -func (r RequestReportRecordContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceCollection. +func (r ResourceCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apiId", r.APIID) - populate(objectMap, "apiRegion", r.APIRegion) - populate(objectMap, "apiTime", r.APITime) - populate(objectMap, "backendResponseCode", r.BackendResponseCode) - populate(objectMap, "cache", r.Cache) - populate(objectMap, "ipAddress", r.IPAddress) - populate(objectMap, "method", r.Method) - populate(objectMap, "operationId", r.OperationID) - populate(objectMap, "productId", r.ProductID) - populate(objectMap, "requestId", r.RequestID) - populate(objectMap, "requestSize", r.RequestSize) - populate(objectMap, "responseCode", r.ResponseCode) - populate(objectMap, "responseSize", r.ResponseSize) - populate(objectMap, "serviceTime", r.ServiceTime) - populate(objectMap, "subscriptionId", r.SubscriptionID) - populateTimeRFC3339(objectMap, "timestamp", r.Timestamp) - populate(objectMap, "url", r.URL) - populate(objectMap, "userId", r.UserID) + populate(objectMap, "count", r.Count) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RequestReportRecordContract. -func (r *RequestReportRecordContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceCollection. +func (r *ResourceCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -10297,59 +12349,14 @@ func (r *RequestReportRecordContract) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "apiId": - err = unpopulate(val, "APIID", &r.APIID) - delete(rawMsg, key) - case "apiRegion": - err = unpopulate(val, "APIRegion", &r.APIRegion) - delete(rawMsg, key) - case "apiTime": - err = unpopulate(val, "APITime", &r.APITime) - delete(rawMsg, key) - case "backendResponseCode": - err = unpopulate(val, "BackendResponseCode", &r.BackendResponseCode) - delete(rawMsg, key) - case "cache": - err = unpopulate(val, "Cache", &r.Cache) - delete(rawMsg, key) - case "ipAddress": - err = unpopulate(val, "IPAddress", &r.IPAddress) - delete(rawMsg, key) - case "method": - err = unpopulate(val, "Method", &r.Method) - delete(rawMsg, key) - case "operationId": - err = unpopulate(val, "OperationID", &r.OperationID) - delete(rawMsg, key) - case "productId": - err = unpopulate(val, "ProductID", &r.ProductID) - delete(rawMsg, key) - case "requestId": - err = unpopulate(val, "RequestID", &r.RequestID) - delete(rawMsg, key) - case "requestSize": - err = unpopulate(val, "RequestSize", &r.RequestSize) - delete(rawMsg, key) - case "responseCode": - err = unpopulate(val, "ResponseCode", &r.ResponseCode) - delete(rawMsg, key) - case "responseSize": - err = unpopulate(val, "ResponseSize", &r.ResponseSize) - delete(rawMsg, key) - case "serviceTime": - err = unpopulate(val, "ServiceTime", &r.ServiceTime) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &r.SubscriptionID) - delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &r.Timestamp) + case "count": + err = unpopulate(val, "Count", &r.Count) delete(rawMsg, key) - case "url": - err = unpopulate(val, "URL", &r.URL) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) delete(rawMsg, key) - case "userId": - err = unpopulate(val, "UserID", &r.UserID) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -10359,8 +12366,8 @@ func (r *RequestReportRecordContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceCollectionValueItem. +func (r ResourceCollectionValueItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) @@ -10368,8 +12375,8 @@ func (r Resource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceCollectionValueItem. +func (r *ResourceCollectionValueItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -11260,16 +13267,21 @@ func (s ServiceBaseProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "apiVersionConstraint", s.APIVersionConstraint) populate(objectMap, "additionalLocations", s.AdditionalLocations) populate(objectMap, "certificates", s.Certificates) + populate(objectMap, "configurationApi", s.ConfigurationAPI) populateTimeRFC3339(objectMap, "createdAtUtc", s.CreatedAtUTC) populate(objectMap, "customProperties", s.CustomProperties) + populate(objectMap, "developerPortalEnabled", s.DeveloperPortalEnabled) populate(objectMap, "developerPortalUrl", s.DeveloperPortalURL) populate(objectMap, "disableGateway", s.DisableGateway) populate(objectMap, "enableClientCertificate", s.EnableClientCertificate) populate(objectMap, "gatewayRegionalUrl", s.GatewayRegionalURL) populate(objectMap, "gatewayUrl", s.GatewayURL) populate(objectMap, "hostnameConfigurations", s.HostnameConfigurations) + populate(objectMap, "legacyPortalEnabled", s.LegacyPortalEnabled) populate(objectMap, "managementApiUrl", s.ManagementAPIURL) + populate(objectMap, "natGatewayState", s.NatGatewayState) populate(objectMap, "notificationSenderEmail", s.NotificationSenderEmail) + populate(objectMap, "outboundPublicIPAddresses", s.OutboundPublicIPAddresses) populate(objectMap, "platformVersion", s.PlatformVersion) populate(objectMap, "portalUrl", s.PortalURL) populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) @@ -11304,12 +13316,18 @@ func (s *ServiceBaseProperties) UnmarshalJSON(data []byte) error { case "certificates": err = unpopulate(val, "Certificates", &s.Certificates) delete(rawMsg, key) + case "configurationApi": + err = unpopulate(val, "ConfigurationAPI", &s.ConfigurationAPI) + delete(rawMsg, key) case "createdAtUtc": err = unpopulateTimeRFC3339(val, "CreatedAtUTC", &s.CreatedAtUTC) delete(rawMsg, key) case "customProperties": err = unpopulate(val, "CustomProperties", &s.CustomProperties) delete(rawMsg, key) + case "developerPortalEnabled": + err = unpopulate(val, "DeveloperPortalEnabled", &s.DeveloperPortalEnabled) + delete(rawMsg, key) case "developerPortalUrl": err = unpopulate(val, "DeveloperPortalURL", &s.DeveloperPortalURL) delete(rawMsg, key) @@ -11328,12 +13346,21 @@ func (s *ServiceBaseProperties) UnmarshalJSON(data []byte) error { case "hostnameConfigurations": err = unpopulate(val, "HostnameConfigurations", &s.HostnameConfigurations) delete(rawMsg, key) + case "legacyPortalEnabled": + err = unpopulate(val, "LegacyPortalEnabled", &s.LegacyPortalEnabled) + delete(rawMsg, key) case "managementApiUrl": err = unpopulate(val, "ManagementAPIURL", &s.ManagementAPIURL) delete(rawMsg, key) + case "natGatewayState": + err = unpopulate(val, "NatGatewayState", &s.NatGatewayState) + delete(rawMsg, key) case "notificationSenderEmail": err = unpopulate(val, "NotificationSenderEmail", &s.NotificationSenderEmail) delete(rawMsg, key) + case "outboundPublicIPAddresses": + err = unpopulate(val, "OutboundPublicIPAddresses", &s.OutboundPublicIPAddresses) + delete(rawMsg, key) case "platformVersion": err = unpopulate(val, "PlatformVersion", &s.PlatformVersion) delete(rawMsg, key) @@ -11573,16 +13600,21 @@ func (s ServiceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "apiVersionConstraint", s.APIVersionConstraint) populate(objectMap, "additionalLocations", s.AdditionalLocations) populate(objectMap, "certificates", s.Certificates) + populate(objectMap, "configurationApi", s.ConfigurationAPI) populateTimeRFC3339(objectMap, "createdAtUtc", s.CreatedAtUTC) populate(objectMap, "customProperties", s.CustomProperties) + populate(objectMap, "developerPortalEnabled", s.DeveloperPortalEnabled) populate(objectMap, "developerPortalUrl", s.DeveloperPortalURL) populate(objectMap, "disableGateway", s.DisableGateway) populate(objectMap, "enableClientCertificate", s.EnableClientCertificate) populate(objectMap, "gatewayRegionalUrl", s.GatewayRegionalURL) populate(objectMap, "gatewayUrl", s.GatewayURL) populate(objectMap, "hostnameConfigurations", s.HostnameConfigurations) + populate(objectMap, "legacyPortalEnabled", s.LegacyPortalEnabled) populate(objectMap, "managementApiUrl", s.ManagementAPIURL) + populate(objectMap, "natGatewayState", s.NatGatewayState) populate(objectMap, "notificationSenderEmail", s.NotificationSenderEmail) + populate(objectMap, "outboundPublicIPAddresses", s.OutboundPublicIPAddresses) populate(objectMap, "platformVersion", s.PlatformVersion) populate(objectMap, "portalUrl", s.PortalURL) populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) @@ -11619,12 +13651,18 @@ func (s *ServiceProperties) UnmarshalJSON(data []byte) error { case "certificates": err = unpopulate(val, "Certificates", &s.Certificates) delete(rawMsg, key) + case "configurationApi": + err = unpopulate(val, "ConfigurationAPI", &s.ConfigurationAPI) + delete(rawMsg, key) case "createdAtUtc": err = unpopulateTimeRFC3339(val, "CreatedAtUTC", &s.CreatedAtUTC) delete(rawMsg, key) case "customProperties": err = unpopulate(val, "CustomProperties", &s.CustomProperties) delete(rawMsg, key) + case "developerPortalEnabled": + err = unpopulate(val, "DeveloperPortalEnabled", &s.DeveloperPortalEnabled) + delete(rawMsg, key) case "developerPortalUrl": err = unpopulate(val, "DeveloperPortalURL", &s.DeveloperPortalURL) delete(rawMsg, key) @@ -11643,12 +13681,21 @@ func (s *ServiceProperties) UnmarshalJSON(data []byte) error { case "hostnameConfigurations": err = unpopulate(val, "HostnameConfigurations", &s.HostnameConfigurations) delete(rawMsg, key) + case "legacyPortalEnabled": + err = unpopulate(val, "LegacyPortalEnabled", &s.LegacyPortalEnabled) + delete(rawMsg, key) case "managementApiUrl": err = unpopulate(val, "ManagementAPIURL", &s.ManagementAPIURL) delete(rawMsg, key) + case "natGatewayState": + err = unpopulate(val, "NatGatewayState", &s.NatGatewayState) + delete(rawMsg, key) case "notificationSenderEmail": err = unpopulate(val, "NotificationSenderEmail", &s.NotificationSenderEmail) delete(rawMsg, key) + case "outboundPublicIPAddresses": + err = unpopulate(val, "OutboundPublicIPAddresses", &s.OutboundPublicIPAddresses) + delete(rawMsg, key) case "platformVersion": err = unpopulate(val, "PlatformVersion", &s.PlatformVersion) delete(rawMsg, key) @@ -11865,16 +13912,21 @@ func (s ServiceUpdateProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "apiVersionConstraint", s.APIVersionConstraint) populate(objectMap, "additionalLocations", s.AdditionalLocations) populate(objectMap, "certificates", s.Certificates) + populate(objectMap, "configurationApi", s.ConfigurationAPI) populateTimeRFC3339(objectMap, "createdAtUtc", s.CreatedAtUTC) populate(objectMap, "customProperties", s.CustomProperties) + populate(objectMap, "developerPortalEnabled", s.DeveloperPortalEnabled) populate(objectMap, "developerPortalUrl", s.DeveloperPortalURL) populate(objectMap, "disableGateway", s.DisableGateway) populate(objectMap, "enableClientCertificate", s.EnableClientCertificate) populate(objectMap, "gatewayRegionalUrl", s.GatewayRegionalURL) populate(objectMap, "gatewayUrl", s.GatewayURL) populate(objectMap, "hostnameConfigurations", s.HostnameConfigurations) + populate(objectMap, "legacyPortalEnabled", s.LegacyPortalEnabled) populate(objectMap, "managementApiUrl", s.ManagementAPIURL) + populate(objectMap, "natGatewayState", s.NatGatewayState) populate(objectMap, "notificationSenderEmail", s.NotificationSenderEmail) + populate(objectMap, "outboundPublicIPAddresses", s.OutboundPublicIPAddresses) populate(objectMap, "platformVersion", s.PlatformVersion) populate(objectMap, "portalUrl", s.PortalURL) populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) @@ -11911,12 +13963,18 @@ func (s *ServiceUpdateProperties) UnmarshalJSON(data []byte) error { case "certificates": err = unpopulate(val, "Certificates", &s.Certificates) delete(rawMsg, key) + case "configurationApi": + err = unpopulate(val, "ConfigurationAPI", &s.ConfigurationAPI) + delete(rawMsg, key) case "createdAtUtc": err = unpopulateTimeRFC3339(val, "CreatedAtUTC", &s.CreatedAtUTC) delete(rawMsg, key) case "customProperties": err = unpopulate(val, "CustomProperties", &s.CustomProperties) delete(rawMsg, key) + case "developerPortalEnabled": + err = unpopulate(val, "DeveloperPortalEnabled", &s.DeveloperPortalEnabled) + delete(rawMsg, key) case "developerPortalUrl": err = unpopulate(val, "DeveloperPortalURL", &s.DeveloperPortalURL) delete(rawMsg, key) @@ -11935,12 +13993,21 @@ func (s *ServiceUpdateProperties) UnmarshalJSON(data []byte) error { case "hostnameConfigurations": err = unpopulate(val, "HostnameConfigurations", &s.HostnameConfigurations) delete(rawMsg, key) + case "legacyPortalEnabled": + err = unpopulate(val, "LegacyPortalEnabled", &s.LegacyPortalEnabled) + delete(rawMsg, key) case "managementApiUrl": err = unpopulate(val, "ManagementAPIURL", &s.ManagementAPIURL) delete(rawMsg, key) + case "natGatewayState": + err = unpopulate(val, "NatGatewayState", &s.NatGatewayState) + delete(rawMsg, key) case "notificationSenderEmail": err = unpopulate(val, "NotificationSenderEmail", &s.NotificationSenderEmail) delete(rawMsg, key) + case "outboundPublicIPAddresses": + err = unpopulate(val, "OutboundPublicIPAddresses", &s.OutboundPublicIPAddresses) + delete(rawMsg, key) case "platformVersion": err = unpopulate(val, "PlatformVersion", &s.PlatformVersion) delete(rawMsg, key) @@ -11994,17 +14061,243 @@ func (s *ServiceUpdateProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionCollection. -func (s SubscriptionCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SubscriptionCollection. +func (s SubscriptionCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", s.Count) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionCollection. +func (s *SubscriptionCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "count": + err = unpopulate(val, "Count", &s.Count) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionContract. +func (s SubscriptionContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionContract. +func (s *SubscriptionContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionContractProperties. +func (s SubscriptionContractProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowTracing", s.AllowTracing) + populateTimeRFC3339(objectMap, "createdDate", s.CreatedDate) + populate(objectMap, "displayName", s.DisplayName) + populateTimeRFC3339(objectMap, "endDate", s.EndDate) + populateTimeRFC3339(objectMap, "expirationDate", s.ExpirationDate) + populateTimeRFC3339(objectMap, "notificationDate", s.NotificationDate) + populate(objectMap, "ownerId", s.OwnerID) + populate(objectMap, "primaryKey", s.PrimaryKey) + populate(objectMap, "scope", s.Scope) + populate(objectMap, "secondaryKey", s.SecondaryKey) + populateTimeRFC3339(objectMap, "startDate", s.StartDate) + populate(objectMap, "state", s.State) + populate(objectMap, "stateComment", s.StateComment) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionContractProperties. +func (s *SubscriptionContractProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowTracing": + err = unpopulate(val, "AllowTracing", &s.AllowTracing) + delete(rawMsg, key) + case "createdDate": + err = unpopulateTimeRFC3339(val, "CreatedDate", &s.CreatedDate) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "endDate": + err = unpopulateTimeRFC3339(val, "EndDate", &s.EndDate) + delete(rawMsg, key) + case "expirationDate": + err = unpopulateTimeRFC3339(val, "ExpirationDate", &s.ExpirationDate) + delete(rawMsg, key) + case "notificationDate": + err = unpopulateTimeRFC3339(val, "NotificationDate", &s.NotificationDate) + delete(rawMsg, key) + case "ownerId": + err = unpopulate(val, "OwnerID", &s.OwnerID) + delete(rawMsg, key) + case "primaryKey": + err = unpopulate(val, "PrimaryKey", &s.PrimaryKey) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &s.Scope) + delete(rawMsg, key) + case "secondaryKey": + err = unpopulate(val, "SecondaryKey", &s.SecondaryKey) + delete(rawMsg, key) + case "startDate": + err = unpopulateTimeRFC3339(val, "StartDate", &s.StartDate) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + delete(rawMsg, key) + case "stateComment": + err = unpopulate(val, "StateComment", &s.StateComment) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionCreateParameterProperties. +func (s SubscriptionCreateParameterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowTracing", s.AllowTracing) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "ownerId", s.OwnerID) + populate(objectMap, "primaryKey", s.PrimaryKey) + populate(objectMap, "scope", s.Scope) + populate(objectMap, "secondaryKey", s.SecondaryKey) + populate(objectMap, "state", s.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionCreateParameterProperties. +func (s *SubscriptionCreateParameterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowTracing": + err = unpopulate(val, "AllowTracing", &s.AllowTracing) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "ownerId": + err = unpopulate(val, "OwnerID", &s.OwnerID) + delete(rawMsg, key) + case "primaryKey": + err = unpopulate(val, "PrimaryKey", &s.PrimaryKey) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &s.Scope) + delete(rawMsg, key) + case "secondaryKey": + err = unpopulate(val, "SecondaryKey", &s.SecondaryKey) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionCreateParameters. +func (s SubscriptionCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionCreateParameters. +func (s *SubscriptionCreateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionKeyParameterNamesContract. +func (s SubscriptionKeyParameterNamesContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", s.Count) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "header", s.Header) + populate(objectMap, "query", s.Query) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionCollection. -func (s *SubscriptionCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionKeyParameterNamesContract. +func (s *SubscriptionKeyParameterNamesContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -12012,14 +14305,11 @@ func (s *SubscriptionCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &s.Count) - delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + case "header": + err = unpopulate(val, "Header", &s.Header) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "query": + err = unpopulate(val, "Query", &s.Query) delete(rawMsg, key) } if err != nil { @@ -12029,18 +14319,16 @@ func (s *SubscriptionCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionContract. -func (s SubscriptionContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SubscriptionKeysContract. +func (s SubscriptionKeysContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) + populate(objectMap, "primaryKey", s.PrimaryKey) + populate(objectMap, "secondaryKey", s.SecondaryKey) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionContract. -func (s *SubscriptionContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionKeysContract. +func (s *SubscriptionKeysContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -12048,17 +14336,11 @@ func (s *SubscriptionContract) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "primaryKey": + err = unpopulate(val, "PrimaryKey", &s.PrimaryKey) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "secondaryKey": + err = unpopulate(val, "SecondaryKey", &s.SecondaryKey) delete(rawMsg, key) } if err != nil { @@ -12068,27 +14350,23 @@ func (s *SubscriptionContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionContractProperties. -func (s SubscriptionContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SubscriptionUpdateParameterProperties. +func (s SubscriptionUpdateParameterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "allowTracing", s.AllowTracing) - populateTimeRFC3339(objectMap, "createdDate", s.CreatedDate) populate(objectMap, "displayName", s.DisplayName) - populateTimeRFC3339(objectMap, "endDate", s.EndDate) populateTimeRFC3339(objectMap, "expirationDate", s.ExpirationDate) - populateTimeRFC3339(objectMap, "notificationDate", s.NotificationDate) populate(objectMap, "ownerId", s.OwnerID) populate(objectMap, "primaryKey", s.PrimaryKey) populate(objectMap, "scope", s.Scope) populate(objectMap, "secondaryKey", s.SecondaryKey) - populateTimeRFC3339(objectMap, "startDate", s.StartDate) populate(objectMap, "state", s.State) populate(objectMap, "stateComment", s.StateComment) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionContractProperties. -func (s *SubscriptionContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionUpdateParameterProperties. +func (s *SubscriptionUpdateParameterProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -12099,21 +14377,12 @@ func (s *SubscriptionContractProperties) UnmarshalJSON(data []byte) error { case "allowTracing": err = unpopulate(val, "AllowTracing", &s.AllowTracing) delete(rawMsg, key) - case "createdDate": - err = unpopulateTimeRFC3339(val, "CreatedDate", &s.CreatedDate) - delete(rawMsg, key) case "displayName": err = unpopulate(val, "DisplayName", &s.DisplayName) delete(rawMsg, key) - case "endDate": - err = unpopulateTimeRFC3339(val, "EndDate", &s.EndDate) - delete(rawMsg, key) case "expirationDate": err = unpopulateTimeRFC3339(val, "ExpirationDate", &s.ExpirationDate) delete(rawMsg, key) - case "notificationDate": - err = unpopulateTimeRFC3339(val, "NotificationDate", &s.NotificationDate) - delete(rawMsg, key) case "ownerId": err = unpopulate(val, "OwnerID", &s.OwnerID) delete(rawMsg, key) @@ -12126,9 +14395,6 @@ func (s *SubscriptionContractProperties) UnmarshalJSON(data []byte) error { case "secondaryKey": err = unpopulate(val, "SecondaryKey", &s.SecondaryKey) delete(rawMsg, key) - case "startDate": - err = unpopulateTimeRFC3339(val, "StartDate", &s.StartDate) - delete(rawMsg, key) case "state": err = unpopulate(val, "State", &s.State) delete(rawMsg, key) @@ -12143,21 +14409,15 @@ func (s *SubscriptionContractProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionCreateParameterProperties. -func (s SubscriptionCreateParameterProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SubscriptionUpdateParameters. +func (s SubscriptionUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "allowTracing", s.AllowTracing) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "ownerId", s.OwnerID) - populate(objectMap, "primaryKey", s.PrimaryKey) - populate(objectMap, "scope", s.Scope) - populate(objectMap, "secondaryKey", s.SecondaryKey) - populate(objectMap, "state", s.State) + populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionCreateParameterProperties. -func (s *SubscriptionCreateParameterProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionUpdateParameters. +func (s *SubscriptionUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -12165,26 +14425,82 @@ func (s *SubscriptionCreateParameterProperties) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "allowTracing": - err = unpopulate(val, "AllowTracing", &s.AllowTracing) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionsDelegationSettingsProperties. +func (s SubscriptionsDelegationSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", s.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionsDelegationSettingsProperties. +func (s *SubscriptionsDelegationSettingsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &s.Enabled) delete(rawMsg, key) - case "ownerId": - err = unpopulate(val, "OwnerID", &s.OwnerID) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) - case "primaryKey": - err = unpopulate(val, "PrimaryKey", &s.PrimaryKey) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &s.Scope) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) - case "secondaryKey": - err = unpopulate(val, "SecondaryKey", &s.SecondaryKey) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &s.State) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { @@ -12194,257 +14510,272 @@ func (s *SubscriptionCreateParameterProperties) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionCreateParameters. -func (s SubscriptionCreateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagAPILinkCollection. +func (t TagAPILinkCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", s.Properties) + populate(objectMap, "count", t.Count) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionCreateParameters. -func (s *SubscriptionCreateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagAPILinkCollection. +func (t *TagAPILinkCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "count": + err = unpopulate(val, "Count", &t.Count) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionKeyParameterNamesContract. -func (s SubscriptionKeyParameterNamesContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagAPILinkContract. +func (t TagAPILinkContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "header", s.Header) - populate(objectMap, "query", s.Query) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionKeyParameterNamesContract. -func (s *SubscriptionKeyParameterNamesContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagAPILinkContract. +func (t *TagAPILinkContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "header": - err = unpopulate(val, "Header", &s.Header) + case "id": + err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &s.Query) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionKeysContract. -func (s SubscriptionKeysContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagAPILinkContractProperties. +func (t TagAPILinkContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "primaryKey", s.PrimaryKey) - populate(objectMap, "secondaryKey", s.SecondaryKey) + populate(objectMap, "apiId", t.APIID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagAPILinkContractProperties. +func (t *TagAPILinkContractProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiId": + err = unpopulate(val, "APIID", &t.APIID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TagCollection. +func (t TagCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", t.Count) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionKeysContract. -func (s *SubscriptionKeysContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagCollection. +func (t *TagCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "primaryKey": - err = unpopulate(val, "PrimaryKey", &s.PrimaryKey) + case "count": + err = unpopulate(val, "Count", &t.Count) delete(rawMsg, key) - case "secondaryKey": - err = unpopulate(val, "SecondaryKey", &s.SecondaryKey) + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionUpdateParameterProperties. -func (s SubscriptionUpdateParameterProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagContract. +func (t TagContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "allowTracing", s.AllowTracing) - populate(objectMap, "displayName", s.DisplayName) - populateTimeRFC3339(objectMap, "expirationDate", s.ExpirationDate) - populate(objectMap, "ownerId", s.OwnerID) - populate(objectMap, "primaryKey", s.PrimaryKey) - populate(objectMap, "scope", s.Scope) - populate(objectMap, "secondaryKey", s.SecondaryKey) - populate(objectMap, "state", s.State) - populate(objectMap, "stateComment", s.StateComment) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionUpdateParameterProperties. -func (s *SubscriptionUpdateParameterProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagContract. +func (t *TagContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "allowTracing": - err = unpopulate(val, "AllowTracing", &s.AllowTracing) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) - delete(rawMsg, key) - case "expirationDate": - err = unpopulateTimeRFC3339(val, "ExpirationDate", &s.ExpirationDate) - delete(rawMsg, key) - case "ownerId": - err = unpopulate(val, "OwnerID", &s.OwnerID) - delete(rawMsg, key) - case "primaryKey": - err = unpopulate(val, "PrimaryKey", &s.PrimaryKey) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &s.Scope) + case "id": + err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "secondaryKey": - err = unpopulate(val, "SecondaryKey", &s.SecondaryKey) + case "name": + err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &s.State) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) delete(rawMsg, key) - case "stateComment": - err = unpopulate(val, "StateComment", &s.StateComment) + case "type": + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionUpdateParameters. -func (s SubscriptionUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagContractProperties. +func (t TagContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", s.Properties) + populate(objectMap, "displayName", t.DisplayName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionUpdateParameters. -func (s *SubscriptionUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagContractProperties. +func (t *TagContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "displayName": + err = unpopulate(val, "DisplayName", &t.DisplayName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionsDelegationSettingsProperties. -func (s SubscriptionsDelegationSettingsProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagCreateUpdateParameters. +func (t TagCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", s.Enabled) + populate(objectMap, "properties", t.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionsDelegationSettingsProperties. -func (s *SubscriptionsDelegationSettingsProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagCreateUpdateParameters. +func (t *TagCreateUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &s.Enabled) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagDescriptionBaseProperties. +func (t TagDescriptionBaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + populate(objectMap, "description", t.Description) + populate(objectMap, "externalDocsDescription", t.ExternalDocsDescription) + populate(objectMap, "externalDocsUrl", t.ExternalDocsURL) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagDescriptionBaseProperties. +func (t *TagDescriptionBaseProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + case "description": + err = unpopulate(val, "Description", &t.Description) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + case "externalDocsDescription": + err = unpopulate(val, "ExternalDocsDescription", &t.ExternalDocsDescription) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + case "externalDocsUrl": + err = unpopulate(val, "ExternalDocsURL", &t.ExternalDocsURL) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TagCollection. -func (t TagCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagDescriptionCollection. +func (t TagDescriptionCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "count", t.Count) populate(objectMap, "nextLink", t.NextLink) @@ -12452,8 +14783,8 @@ func (t TagCollection) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TagCollection. -func (t *TagCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagDescriptionCollection. +func (t *TagDescriptionCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -12478,8 +14809,8 @@ func (t *TagCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TagContract. -func (t TagContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagDescriptionContract. +func (t TagDescriptionContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", t.ID) populate(objectMap, "name", t.Name) @@ -12488,8 +14819,8 @@ func (t TagContract) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TagContract. -func (t *TagContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagDescriptionContract. +func (t *TagDescriptionContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -12517,15 +14848,19 @@ func (t *TagContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TagContractProperties. -func (t TagContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagDescriptionContractProperties. +func (t TagDescriptionContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "description", t.Description) populate(objectMap, "displayName", t.DisplayName) + populate(objectMap, "externalDocsDescription", t.ExternalDocsDescription) + populate(objectMap, "externalDocsUrl", t.ExternalDocsURL) + populate(objectMap, "tagId", t.TagID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TagContractProperties. -func (t *TagContractProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagDescriptionContractProperties. +func (t *TagDescriptionContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -12533,9 +14868,21 @@ func (t *TagContractProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "description": + err = unpopulate(val, "Description", &t.Description) + delete(rawMsg, key) case "displayName": err = unpopulate(val, "DisplayName", &t.DisplayName) delete(rawMsg, key) + case "externalDocsDescription": + err = unpopulate(val, "ExternalDocsDescription", &t.ExternalDocsDescription) + delete(rawMsg, key) + case "externalDocsUrl": + err = unpopulate(val, "ExternalDocsURL", &t.ExternalDocsURL) + delete(rawMsg, key) + case "tagId": + err = unpopulate(val, "TagID", &t.TagID) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -12544,15 +14891,80 @@ func (t *TagContractProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TagCreateUpdateParameters. -func (t TagCreateUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagDescriptionCreateParameters. +func (t TagDescriptionCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", t.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagDescriptionCreateParameters. +func (t *TagDescriptionCreateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TagOperationLinkCollection. +func (t TagOperationLinkCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", t.Count) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagOperationLinkCollection. +func (t *TagOperationLinkCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "count": + err = unpopulate(val, "Count", &t.Count) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TagOperationLinkContract. +func (t TagOperationLinkContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) populate(objectMap, "properties", t.Properties) + populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TagCreateUpdateParameters. -func (t *TagCreateUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagOperationLinkContract. +func (t *TagOperationLinkContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -12560,9 +14972,18 @@ func (t *TagCreateUpdateParameters) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &t.Properties) delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -12571,17 +14992,15 @@ func (t *TagCreateUpdateParameters) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TagDescriptionBaseProperties. -func (t TagDescriptionBaseProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagOperationLinkContractProperties. +func (t TagOperationLinkContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", t.Description) - populate(objectMap, "externalDocsDescription", t.ExternalDocsDescription) - populate(objectMap, "externalDocsUrl", t.ExternalDocsURL) + populate(objectMap, "operationId", t.OperationID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TagDescriptionBaseProperties. -func (t *TagDescriptionBaseProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagOperationLinkContractProperties. +func (t *TagOperationLinkContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -12589,14 +15008,8 @@ func (t *TagDescriptionBaseProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &t.Description) - delete(rawMsg, key) - case "externalDocsDescription": - err = unpopulate(val, "ExternalDocsDescription", &t.ExternalDocsDescription) - delete(rawMsg, key) - case "externalDocsUrl": - err = unpopulate(val, "ExternalDocsURL", &t.ExternalDocsURL) + case "operationId": + err = unpopulate(val, "OperationID", &t.OperationID) delete(rawMsg, key) } if err != nil { @@ -12606,8 +15019,8 @@ func (t *TagDescriptionBaseProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TagDescriptionCollection. -func (t TagDescriptionCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagProductLinkCollection. +func (t TagProductLinkCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "count", t.Count) populate(objectMap, "nextLink", t.NextLink) @@ -12615,8 +15028,8 @@ func (t TagDescriptionCollection) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TagDescriptionCollection. -func (t *TagDescriptionCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagProductLinkCollection. +func (t *TagProductLinkCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -12641,8 +15054,8 @@ func (t *TagDescriptionCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TagDescriptionContract. -func (t TagDescriptionContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagProductLinkContract. +func (t TagProductLinkContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", t.ID) populate(objectMap, "name", t.Name) @@ -12651,8 +15064,8 @@ func (t TagDescriptionContract) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TagDescriptionContract. -func (t *TagDescriptionContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagProductLinkContract. +func (t *TagProductLinkContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -12680,58 +15093,15 @@ func (t *TagDescriptionContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TagDescriptionContractProperties. -func (t TagDescriptionContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", t.Description) - populate(objectMap, "displayName", t.DisplayName) - populate(objectMap, "externalDocsDescription", t.ExternalDocsDescription) - populate(objectMap, "externalDocsUrl", t.ExternalDocsURL) - populate(objectMap, "tagId", t.TagID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TagDescriptionContractProperties. -func (t *TagDescriptionContractProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &t.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &t.DisplayName) - delete(rawMsg, key) - case "externalDocsDescription": - err = unpopulate(val, "ExternalDocsDescription", &t.ExternalDocsDescription) - delete(rawMsg, key) - case "externalDocsUrl": - err = unpopulate(val, "ExternalDocsURL", &t.ExternalDocsURL) - delete(rawMsg, key) - case "tagId": - err = unpopulate(val, "TagID", &t.TagID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TagDescriptionCreateParameters. -func (t TagDescriptionCreateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagProductLinkContractProperties. +func (t TagProductLinkContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", t.Properties) + populate(objectMap, "productId", t.ProductID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TagDescriptionCreateParameters. -func (t *TagDescriptionCreateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagProductLinkContractProperties. +func (t *TagProductLinkContractProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -12739,8 +15109,8 @@ func (t *TagDescriptionCreateParameters) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &t.Properties) + case "productId": + err = unpopulate(val, "ProductID", &t.ProductID) delete(rawMsg, key) } if err != nil { @@ -13657,6 +16027,262 @@ func (v *VirtualNetworkConfiguration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type WikiCollection. +func (w WikiCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WikiCollection. +func (w *WikiCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WikiContract. +func (w WikiContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WikiContract. +func (w *WikiContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WikiContractProperties. +func (w WikiContractProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "documents", w.Documents) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WikiContractProperties. +func (w *WikiContractProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "documents": + err = unpopulate(val, "Documents", &w.Documents) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WikiDocumentationContract. +func (w WikiDocumentationContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "documentationId", w.DocumentationID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WikiDocumentationContract. +func (w *WikiDocumentationContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "documentationId": + err = unpopulate(val, "DocumentationID", &w.DocumentationID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WikiUpdateContract. +func (w WikiUpdateContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", w.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WikiUpdateContract. +func (w *WikiUpdateContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkspaceCollection. +func (w WorkspaceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", w.Count) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceCollection. +func (w *WorkspaceCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "count": + err = unpopulate(val, "Count", &w.Count) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkspaceContract. +func (w WorkspaceContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceContract. +func (w *WorkspaceContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkspaceContractProperties. +func (w WorkspaceContractProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", w.Description) + populate(objectMap, "displayName", w.DisplayName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceContractProperties. +func (w *WorkspaceContractProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &w.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type X509CertificateName. func (x X509CertificateName) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/namedvalue_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/namedvalue_client.go index 32a875a6c0f2..d2f3f23b96f4 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/namedvalue_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/namedvalue_client.go @@ -30,8 +30,7 @@ type NamedValueClient struct { } // NewNamedValueClient creates a new instance of NamedValueClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewNamedValueClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NamedValueClient, error) { @@ -49,8 +48,8 @@ func NewNamedValueClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreateOrUpdate - Creates or updates named value. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - namedValueID - Identifier of the NamedValue. // - parameters - Create parameters. @@ -73,7 +72,7 @@ func (client *NamedValueClient) BeginCreateOrUpdate(ctx context.Context, resourc // CreateOrUpdate - Creates or updates named value. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *NamedValueClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, parameters NamedValueCreateContract, options *NamedValueClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, namedValueID, parameters, options) if err != nil { @@ -113,7 +112,7 @@ func (client *NamedValueClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -125,8 +124,8 @@ func (client *NamedValueClient) createOrUpdateCreateRequest(ctx context.Context, // Delete - Deletes specific named value from the API Management service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - namedValueID - Identifier of the NamedValue. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -171,7 +170,7 @@ func (client *NamedValueClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -181,8 +180,8 @@ func (client *NamedValueClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets the details of the named value specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - namedValueID - Identifier of the NamedValue. // - options - NamedValueClientGetOptions contains the optional parameters for the NamedValueClient.Get method. @@ -225,7 +224,7 @@ func (client *NamedValueClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -245,8 +244,8 @@ func (client *NamedValueClient) getHandleResponse(resp *http.Response) (NamedVal // GetEntityTag - Gets the entity state (Etag) version of the named value specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - namedValueID - Identifier of the NamedValue. // - options - NamedValueClientGetEntityTagOptions contains the optional parameters for the NamedValueClient.GetEntityTag method. @@ -289,7 +288,7 @@ func (client *NamedValueClient) getEntityTagCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -307,8 +306,8 @@ func (client *NamedValueClient) getEntityTagHandleResponse(resp *http.Response) // NewListByServicePager - Lists a collection of named values defined within a service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - NamedValueClientListByServiceOptions contains the optional parameters for the NamedValueClient.NewListByServicePager // method. @@ -372,7 +371,7 @@ func (client *NamedValueClient) listByServiceCreateRequest(ctx context.Context, if options != nil && options.IsKeyVaultRefreshFailed != nil { reqQP.Set("isKeyVaultRefreshFailed", strconv.FormatBool(*options.IsKeyVaultRefreshFailed)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -390,8 +389,8 @@ func (client *NamedValueClient) listByServiceHandleResponse(resp *http.Response) // ListValue - Gets the secret of the named value specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - namedValueID - Identifier of the NamedValue. // - options - NamedValueClientListValueOptions contains the optional parameters for the NamedValueClient.ListValue method. @@ -434,7 +433,7 @@ func (client *NamedValueClient) listValueCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -455,8 +454,8 @@ func (client *NamedValueClient) listValueHandleResponse(resp *http.Response) (Na // BeginRefreshSecret - Refresh the secret of the named value specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - namedValueID - Identifier of the NamedValue. // - options - NamedValueClientBeginRefreshSecretOptions contains the optional parameters for the NamedValueClient.BeginRefreshSecret @@ -478,7 +477,7 @@ func (client *NamedValueClient) BeginRefreshSecret(ctx context.Context, resource // RefreshSecret - Refresh the secret of the named value specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *NamedValueClient) refreshSecret(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, options *NamedValueClientBeginRefreshSecretOptions) (*http.Response, error) { req, err := client.refreshSecretCreateRequest(ctx, resourceGroupName, serviceName, namedValueID, options) if err != nil { @@ -518,7 +517,7 @@ func (client *NamedValueClient) refreshSecretCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -527,8 +526,8 @@ func (client *NamedValueClient) refreshSecretCreateRequest(ctx context.Context, // BeginUpdate - Updates the specific named value. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - namedValueID - Identifier of the NamedValue. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -552,7 +551,7 @@ func (client *NamedValueClient) BeginUpdate(ctx context.Context, resourceGroupNa // Update - Updates the specific named value. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *NamedValueClient) update(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, ifMatch string, parameters NamedValueUpdateParameters, options *NamedValueClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, namedValueID, ifMatch, parameters, options) if err != nil { @@ -592,7 +591,7 @@ func (client *NamedValueClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/namedvalue_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/namedvalue_client_example_test.go deleted file mode 100644 index 5f5d0ee0387b..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/namedvalue_client_example_test.go +++ /dev/null @@ -1,403 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListNamedValues.json -func ExampleNamedValueClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNamedValueClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.NamedValueClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: nil, - IsKeyVaultRefreshFailed: 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.NamedValueCollection = armapimanagement.NamedValueCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.NamedValueContract{ - // { - // Name: to.Ptr("592f1174cc83890dc4f32686"), - // Type: to.Ptr("Microsoft.ApiManagement/service/namedValues"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/592f1174cc83890dc4f32686"), - // Properties: &armapimanagement.NamedValueContractProperties{ - // Secret: to.Ptr(false), - // DisplayName: to.Ptr("Logger-Credentials-592f1174cc83890dc4f32687"), - // Value: to.Ptr("propValue"), - // }, - // }, - // { - // Name: to.Ptr("testprop6"), - // Type: to.Ptr("Microsoft.ApiManagement/service/namedValues"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop6"), - // Properties: &armapimanagement.NamedValueContractProperties{ - // Secret: to.Ptr(true), - // Tags: []*string{ - // to.Ptr("foo"), - // to.Ptr("bar")}, - // DisplayName: to.Ptr("prop6namekv"), - // KeyVault: &armapimanagement.KeyVaultContractProperties{ - // IdentityClientID: to.Ptr("2d2df842-44d8-4885-8dec-77cc1a984a31"), - // SecretIdentifier: to.Ptr("https://contoso.vault.azure.net/secrets/aadSecret"), - // LastStatus: &armapimanagement.KeyVaultLastAccessStatusContractProperties{ - // Code: to.Ptr("Success"), - // TimeStampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-11T00:54:31.8024882Z"); return t}()), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadNamedValue.json -func ExampleNamedValueClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewNamedValueClient().GetEntityTag(ctx, "rg1", "apimService1", "testarmTemplateproperties2", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNamedValue.json -func ExampleNamedValueClient_Get_apiManagementGetNamedValue() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamedValueClient().Get(ctx, "rg1", "apimService1", "testarmTemplateproperties2", 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.NamedValueContract = armapimanagement.NamedValueContract{ - // Name: to.Ptr("testarmTemplateproperties2"), - // Type: to.Ptr("Microsoft.ApiManagement/service/namedValues"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testarmTemplateproperties2"), - // Properties: &armapimanagement.NamedValueContractProperties{ - // Secret: to.Ptr(false), - // Tags: []*string{ - // to.Ptr("foo"), - // to.Ptr("bar")}, - // DisplayName: to.Ptr("propName"), - // Value: to.Ptr("propValue"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNamedValueWithKeyVault.json -func ExampleNamedValueClient_Get_apiManagementGetNamedValueWithKeyVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamedValueClient().Get(ctx, "rg1", "apimService1", "testprop6", 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.NamedValueContract = armapimanagement.NamedValueContract{ - // Name: to.Ptr("testprop6"), - // Type: to.Ptr("Microsoft.ApiManagement/service/namedValues"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop6"), - // Properties: &armapimanagement.NamedValueContractProperties{ - // Secret: to.Ptr(true), - // Tags: []*string{ - // to.Ptr("foo"), - // to.Ptr("bar")}, - // DisplayName: to.Ptr("prop6namekv"), - // KeyVault: &armapimanagement.KeyVaultContractProperties{ - // IdentityClientID: to.Ptr("2d2df842-44d8-4885-8dec-77cc1a984a31"), - // SecretIdentifier: to.Ptr("https://rpbvtkeyvaultintegration.vault-int.azure-int.net/secrets/msitestingCert"), - // LastStatus: &armapimanagement.KeyVaultLastAccessStatusContractProperties{ - // Code: to.Ptr("Success"), - // TimeStampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-11T00:54:31.8024882Z"); return t}()), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNamedValue.json -func ExampleNamedValueClient_BeginCreateOrUpdate_apiManagementCreateNamedValue() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamedValueClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "testprop2", armapimanagement.NamedValueCreateContract{ - Properties: &armapimanagement.NamedValueCreateContractProperties{ - Secret: to.Ptr(false), - Tags: []*string{ - to.Ptr("foo"), - to.Ptr("bar")}, - DisplayName: to.Ptr("prop3name"), - Value: to.Ptr("propValue"), - }, - }, &armapimanagement.NamedValueClientBeginCreateOrUpdateOptions{IfMatch: 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.NamedValueContract = armapimanagement.NamedValueContract{ - // Name: to.Ptr("testprop2"), - // Type: to.Ptr("Microsoft.ApiManagement/service/namedValues"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop2"), - // Properties: &armapimanagement.NamedValueContractProperties{ - // Secret: to.Ptr(false), - // Tags: []*string{ - // to.Ptr("foo"), - // to.Ptr("bar")}, - // DisplayName: to.Ptr("prop3name"), - // Value: to.Ptr("propValue"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNamedValueWithKeyVault.json -func ExampleNamedValueClient_BeginCreateOrUpdate_apiManagementCreateNamedValueWithKeyVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamedValueClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "testprop6", armapimanagement.NamedValueCreateContract{ - Properties: &armapimanagement.NamedValueCreateContractProperties{ - Secret: to.Ptr(true), - Tags: []*string{ - to.Ptr("foo"), - to.Ptr("bar")}, - DisplayName: to.Ptr("prop6namekv"), - KeyVault: &armapimanagement.KeyVaultContractCreateProperties{ - IdentityClientID: to.Ptr("ceaa6b06-c00f-43ef-99ac-f53d1fe876a0"), - SecretIdentifier: to.Ptr("https://contoso.vault.azure.net/secrets/aadSecret"), - }, - }, - }, &armapimanagement.NamedValueClientBeginCreateOrUpdateOptions{IfMatch: 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.NamedValueContract = armapimanagement.NamedValueContract{ - // Name: to.Ptr("testprop6"), - // Type: to.Ptr("Microsoft.ApiManagement/service/namedValues"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop6"), - // Properties: &armapimanagement.NamedValueContractProperties{ - // Secret: to.Ptr(true), - // Tags: []*string{ - // to.Ptr("foo"), - // to.Ptr("bar")}, - // DisplayName: to.Ptr("prop6namekv"), - // KeyVault: &armapimanagement.KeyVaultContractProperties{ - // IdentityClientID: to.Ptr("ceaa6b06-c00f-43ef-99ac-f53d1fe876a0"), - // SecretIdentifier: to.Ptr("https://contoso.vault.azure.net/secrets/aadSecret"), - // LastStatus: &armapimanagement.KeyVaultLastAccessStatusContractProperties{ - // Code: to.Ptr("Success"), - // TimeStampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-11T00:54:31.8024882Z"); return t}()), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateNamedValue.json -func ExampleNamedValueClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamedValueClient().BeginUpdate(ctx, "rg1", "apimService1", "testprop2", "*", armapimanagement.NamedValueUpdateParameters{ - Properties: &armapimanagement.NamedValueUpdateParameterProperties{ - Secret: to.Ptr(false), - Tags: []*string{ - to.Ptr("foo"), - to.Ptr("bar2")}, - DisplayName: to.Ptr("prop3name"), - Value: to.Ptr("propValue"), - }, - }, 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.NamedValueContract = armapimanagement.NamedValueContract{ - // Type: to.Ptr("Microsoft.ApiManagement/service/namedValues"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop2"), - // Properties: &armapimanagement.NamedValueContractProperties{ - // Secret: to.Ptr(false), - // Tags: []*string{ - // to.Ptr("foo"), - // to.Ptr("bar2")}, - // DisplayName: to.Ptr("prop3name"), - // Value: to.Ptr("propValue"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteNamedValue.json -func ExampleNamedValueClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewNamedValueClient().Delete(ctx, "rg1", "apimService1", "testprop2", "*", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementNamedValueListValue.json -func ExampleNamedValueClient_ListValue() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamedValueClient().ListValue(ctx, "rg1", "apimService1", "testarmTemplateproperties2", 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.NamedValueSecretContract = armapimanagement.NamedValueSecretContract{ - // Value: to.Ptr("propValue"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementRefreshNamedValue.json -func ExampleNamedValueClient_BeginRefreshSecret() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamedValueClient().BeginRefreshSecret(ctx, "rg1", "apimService1", "testprop2", 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.NamedValueContract = armapimanagement.NamedValueContract{ - // Name: to.Ptr("testprop6"), - // Type: to.Ptr("Microsoft.ApiManagement/service/namedValues"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop6"), - // Properties: &armapimanagement.NamedValueContractProperties{ - // Secret: to.Ptr(true), - // Tags: []*string{ - // to.Ptr("foo"), - // to.Ptr("bar")}, - // DisplayName: to.Ptr("prop6namekv"), - // KeyVault: &armapimanagement.KeyVaultContractProperties{ - // IdentityClientID: to.Ptr("2d2df842-44d8-4885-8dec-77cc1a984a31"), - // SecretIdentifier: to.Ptr("https://rpbvtkeyvaultintegration.vault.azure.net/secrets/msitestingCert"), - // LastStatus: &armapimanagement.KeyVaultLastAccessStatusContractProperties{ - // Code: to.Ptr("Success"), - // TimeStampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-11T00:54:31.8024882Z"); return t}()), - // }, - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/networkstatus_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/networkstatus_client.go index 219ba49985ca..1a3c08030983 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/networkstatus_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/networkstatus_client.go @@ -29,8 +29,7 @@ type NetworkStatusClient struct { } // NewNetworkStatusClient creates a new instance of NetworkStatusClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewNetworkStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NetworkStatusClient, error) { @@ -49,8 +48,8 @@ func NewNetworkStatusClient(subscriptionID string, credential azcore.TokenCreden // inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - locationName - Location in which the API Management service is deployed. This is one of the Azure Regions like West US, // East US, South Central US. @@ -95,7 +94,7 @@ func (client *NetworkStatusClient) listByLocationCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,8 +113,8 @@ func (client *NetworkStatusClient) listByLocationHandleResponse(resp *http.Respo // inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - NetworkStatusClientListByServiceOptions contains the optional parameters for the NetworkStatusClient.ListByService // method. @@ -154,7 +153,7 @@ func (client *NetworkStatusClient) listByServiceCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/networkstatus_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/networkstatus_client_example_test.go deleted file mode 100644 index 79f4a3bc9e6e..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/networkstatus_client_example_test.go +++ /dev/null @@ -1,324 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetNetworkStatus.json -func ExampleNetworkStatusClient_ListByService() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNetworkStatusClient().ListByService(ctx, "rg1", "apimService1", 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.NetworkStatusContractByLocationArray = []*armapimanagement.NetworkStatusContractByLocation{ - // { - // Location: to.Ptr("West US"), - // NetworkStatus: &armapimanagement.NetworkStatusContract{ - // ConnectivityStatus: []*armapimanagement.ConnectivityStatusContract{ - // { - // Name: to.Ptr("apimgmtst6xxxxxxxxxxx.blob.core.windows.net"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(false), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:55.9365931Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:55:14.7035899Z"); return t}()), - // ResourceType: to.Ptr("BlobStorage"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("apimgmtst6xxxxxxxxxxx.file.core.windows.net"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:55.9265938Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:55:41.5322463Z"); return t}()), - // ResourceType: to.Ptr("FileStorage"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("apimgmtst6xxxxxxxxxxx.queue.core.windows.net"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:55.8410477Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:55:30.645994Z"); return t}()), - // ResourceType: to.Ptr("Queue"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("apimgmtst6xxxxxxxxxxx.table.core.windows.net"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(false), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:55.9365931Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:55:23.8789171Z"); return t}()), - // ResourceType: to.Ptr("TableStorage"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("gcs.prod.monitoring.core.windows.net"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T08:07:37.5486932Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:57:34.8666833Z"); return t}()), - // ResourceType: to.Ptr("Monitoring"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("https://gcs.ppe.warm.ingestion.monitoring.azure.com"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:56.1060523Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:56:26.1870188Z"); return t}()), - // ResourceType: to.Ptr("Monitoring"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("https://global.metrics.nsatc.net/"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:56.0510519Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:56:35.9620612Z"); return t}()), - // ResourceType: to.Ptr("Monitoring"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("https://login.windows.net"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:56.1060523Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:56:30.8047708Z"); return t}()), - // ResourceType: to.Ptr("AzureActiveDirectory"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("https://prod2.metrics.nsatc.net:1886/RecoveryService"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:56.2796235Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:56:45.2095302Z"); return t}()), - // ResourceType: to.Ptr("Metrics"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("LocalGatewayRedis"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:55.9365931Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:55:15.1345836Z"); return t}()), - // ResourceType: to.Ptr("InternalCache"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("prod.warmpath.msftcloudes.com"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(false), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:55.8410477Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:55:57.8992141Z"); return t}()), - // ResourceType: to.Ptr("Monitoring"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("Scm"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-20T02:25:48.7066996Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T23:01:24.0553684Z"); return t}()), - // ResourceType: to.Ptr("SourceControl"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("smtpi-ch1.msn.com:25028"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:56.3510577Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:58:22.2430074Z"); return t}()), - // ResourceType: to.Ptr("Email"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("zwcvuxxxx.database.windows.net"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(false), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:56.0410467Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:55:44.3582171Z"); return t}()), - // ResourceType: to.Ptr("SQLDatabase"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }}, - // DNSServers: []*string{ - // to.Ptr("10.82.98.10")}, - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetNetworkStatusByLocation.json -func ExampleNetworkStatusClient_ListByLocation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNetworkStatusClient().ListByLocation(ctx, "rg1", "apimService1", "North Central US", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NetworkStatusContract = armapimanagement.NetworkStatusContract{ - // ConnectivityStatus: []*armapimanagement.ConnectivityStatusContract{ - // { - // Name: to.Ptr("apimgmtst6tnxxxxxxxxxxx.blob.core.windows.net"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(false), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:55.9365931Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:55:14.7035899Z"); return t}()), - // ResourceType: to.Ptr("BlobStorage"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("apimgmtst6tnxxxxxxxxxxx.file.core.windows.net"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:55.9265938Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:55:41.5322463Z"); return t}()), - // ResourceType: to.Ptr("FileStorage"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("apimgmtst6tnxxxxxxxxxxx.queue.core.windows.net"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:55.8410477Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:55:30.645994Z"); return t}()), - // ResourceType: to.Ptr("Queue"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("apimgmtst6tnxxxxxxxxxxx.table.core.windows.net"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(false), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:55.9365931Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:55:23.8789171Z"); return t}()), - // ResourceType: to.Ptr("TableStorage"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("gcs.prod.monitoring.core.windows.net"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T08:07:37.5486932Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:57:34.8666833Z"); return t}()), - // ResourceType: to.Ptr("Monitoring"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("https://gcs.ppe.warm.ingestion.monitoring.azure.com"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:56.1060523Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:56:26.1870188Z"); return t}()), - // ResourceType: to.Ptr("Monitoring"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("https://global.metrics.nsatc.net/"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:56.0510519Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:56:35.9620612Z"); return t}()), - // ResourceType: to.Ptr("Monitoring"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("https://login.windows.net"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:56.1060523Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:56:30.8047708Z"); return t}()), - // ResourceType: to.Ptr("AzureActiveDirectory"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("https://prod2.metrics.nsatc.net:1886/RecoveryService"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:56.2796235Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:56:45.2095302Z"); return t}()), - // ResourceType: to.Ptr("Metrics"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("LocalGatewayRedis"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:55.9365931Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:55:15.1345836Z"); return t}()), - // ResourceType: to.Ptr("InternalCache"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("prod.warmpath.msftcloudes.com"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(false), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:55.8410477Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:55:57.8992141Z"); return t}()), - // ResourceType: to.Ptr("Monitoring"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("Scm"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:57.325384Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T23:03:57.6187917Z"); return t}()), - // ResourceType: to.Ptr("SourceControl"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("smtpi-xxx.msn.com:25028"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(true), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:56.3510577Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:58:22.2430074Z"); return t}()), - // ResourceType: to.Ptr("Email"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }, - // { - // Name: to.Ptr("zwcvuxxxx.database.windows.net"), - // Error: to.Ptr(""), - // IsOptional: to.Ptr(false), - // LastStatusChange: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-20T07:54:56.0410467Z"); return t}()), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-24T22:55:44.3582171Z"); return t}()), - // ResourceType: to.Ptr("SQLDatabase"), - // Status: to.Ptr(armapimanagement.ConnectivityStatusTypeSuccess), - // }}, - // DNSServers: []*string{ - // to.Ptr("10.82.98.10")}, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/notification_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/notification_client.go index 0da7cb4f98cf..34f846064276 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/notification_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/notification_client.go @@ -30,8 +30,7 @@ type NotificationClient struct { } // NewNotificationClient creates a new instance of NotificationClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewNotificationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NotificationClient, error) { @@ -49,8 +48,8 @@ func NewNotificationClient(subscriptionID string, credential azcore.TokenCredent // CreateOrUpdate - Create or Update API Management publisher notification. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - notificationName - Notification Name Identifier. // - options - NotificationClientCreateOrUpdateOptions contains the optional parameters for the NotificationClient.CreateOrUpdate @@ -94,7 +93,7 @@ func (client *NotificationClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -115,8 +114,8 @@ func (client *NotificationClient) createOrUpdateHandleResponse(resp *http.Respon // Get - Gets the details of the Notification specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - notificationName - Notification Name Identifier. // - options - NotificationClientGetOptions contains the optional parameters for the NotificationClient.Get method. @@ -159,7 +158,7 @@ func (client *NotificationClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -176,8 +175,8 @@ func (client *NotificationClient) getHandleResponse(resp *http.Response) (Notifi // NewListByServicePager - Lists a collection of properties defined within a service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - NotificationClientListByServiceOptions contains the optional parameters for the NotificationClient.NewListByServicePager // method. @@ -235,7 +234,7 @@ func (client *NotificationClient) listByServiceCreateRequest(ctx context.Context if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/notification_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/notification_client_example_test.go deleted file mode 100644 index a699db6872bb..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/notification_client_example_test.go +++ /dev/null @@ -1,230 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListNotifications.json -func ExampleNotificationClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNotificationClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.NotificationClientListByServiceOptions{Top: nil, - Skip: 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.NotificationCollection = armapimanagement.NotificationCollection{ - // Count: to.Ptr[int64](7), - // Value: []*armapimanagement.NotificationContract{ - // { - // Name: to.Ptr("RequestPublisherNotificationMessage"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage"), - // Properties: &armapimanagement.NotificationContractProperties{ - // Description: to.Ptr("The following email recipients and users will receive email notifications about subscription requests for API products requiring approval."), - // Recipients: &armapimanagement.RecipientsContractProperties{ - // Emails: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage/recipientEmails/contoso@live.com"), - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage/recipientEmails/foobar!live"), - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage/recipientEmails/foobar@live.com")}, - // Users: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/576823d0a40f7e74ec07d642")}, - // }, - // Title: to.Ptr("Subscription requests (requiring approval)"), - // }, - // }, - // { - // Name: to.Ptr("PurchasePublisherNotificationMessage"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/PurchasePublisherNotificationMessage"), - // Properties: &armapimanagement.NotificationContractProperties{ - // Description: to.Ptr("The following email recipients and users will receive email notifications about new API product subscriptions."), - // Recipients: &armapimanagement.RecipientsContractProperties{ - // Emails: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage/recipientEmails/contoso@live.com")}, - // Users: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1")}, - // }, - // Title: to.Ptr("New subscriptions"), - // }, - // }, - // { - // Name: to.Ptr("NewApplicationNotificationMessage"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/NewApplicationNotificationMessage"), - // Properties: &armapimanagement.NotificationContractProperties{ - // Description: to.Ptr("The following email recipients and users will receive email notifications when new applications are submitted to the application gallery."), - // Recipients: &armapimanagement.RecipientsContractProperties{ - // Emails: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage/recipientEmails/contoso@live.com")}, - // Users: []*string{ - // }, - // }, - // Title: to.Ptr("Application gallery requests"), - // }, - // }, - // { - // Name: to.Ptr("BCC"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/BCC"), - // Properties: &armapimanagement.NotificationContractProperties{ - // Description: to.Ptr("The following recipients will receive blind carbon copies of all emails sent to developers."), - // Recipients: &armapimanagement.RecipientsContractProperties{ - // Emails: []*string{ - // }, - // Users: []*string{ - // }, - // }, - // Title: to.Ptr("BCC"), - // }, - // }, - // { - // Name: to.Ptr("NewIssuePublisherNotificationMessage"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/NewIssuePublisherNotificationMessage"), - // Properties: &armapimanagement.NotificationContractProperties{ - // Description: to.Ptr("The following email recipients and users will receive email notifications when a new issue or comment is submitted on the developer portal."), - // Recipients: &armapimanagement.RecipientsContractProperties{ - // Emails: []*string{ - // }, - // Users: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1")}, - // }, - // Title: to.Ptr("New issue or comment"), - // }, - // }, - // { - // Name: to.Ptr("AccountClosedPublisher"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/AccountClosedPublisher"), - // Properties: &armapimanagement.NotificationContractProperties{ - // Description: to.Ptr("The following email recipients and users will receive email notifications when developer closes his account"), - // Recipients: &armapimanagement.RecipientsContractProperties{ - // Emails: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage/recipientEmails/contoso@live.com")}, - // Users: []*string{ - // }, - // }, - // Title: to.Ptr("Close account message"), - // }, - // }, - // { - // Name: to.Ptr("QuotaLimitApproachingPublisherNotificationMessage"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/QuotaLimitApproachingPublisherNotificationMessage"), - // Properties: &armapimanagement.NotificationContractProperties{ - // Description: to.Ptr("The following email recipients and users will receive email notifications when subscription usage gets close to usage quota."), - // Recipients: &armapimanagement.RecipientsContractProperties{ - // Emails: []*string{ - // }, - // Users: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1")}, - // }, - // Title: to.Ptr("Approaching subscription quota limit"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNotification.json -func ExampleNotificationClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNotificationClient().Get(ctx, "rg1", "apimService1", armapimanagement.NotificationNameRequestPublisherNotificationMessage, 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.NotificationContract = armapimanagement.NotificationContract{ - // Name: to.Ptr("RequestPublisherNotificationMessage"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage"), - // Properties: &armapimanagement.NotificationContractProperties{ - // Description: to.Ptr("The following email recipients and users will receive email notifications about subscription requests for API products requiring approval."), - // Recipients: &armapimanagement.RecipientsContractProperties{ - // Emails: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/recipientEmails/contoso@live.com"), - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/recipientEmails/foobar!live"), - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/recipientEmails/foobar@live.com")}, - // Users: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/576823d0a40f7e74ec07d642")}, - // }, - // Title: to.Ptr("Subscription requests (requiring approval)"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNotification.json -func ExampleNotificationClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNotificationClient().CreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.NotificationNameRequestPublisherNotificationMessage, &armapimanagement.NotificationClientCreateOrUpdateOptions{IfMatch: 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.NotificationContract = armapimanagement.NotificationContract{ - // Name: to.Ptr("RequestPublisherNotificationMessage"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage"), - // Properties: &armapimanagement.NotificationContractProperties{ - // Description: to.Ptr("The following email recipients and users will receive email notifications about subscription requests for API products requiring approval."), - // Recipients: &armapimanagement.RecipientsContractProperties{ - // Emails: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/recipientEmails/contoso@live.com"), - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/recipientEmails/foobar!live"), - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/recipientEmails/foobar@live.com")}, - // Users: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/576823d0a40f7e74ec07d642")}, - // }, - // Title: to.Ptr("Subscription requests (requiring approval)"), - // }, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/notificationrecipientemail_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/notificationrecipientemail_client.go index 210708dae801..c0708ef7657b 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/notificationrecipientemail_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/notificationrecipientemail_client.go @@ -29,8 +29,7 @@ type NotificationRecipientEmailClient struct { } // NewNotificationRecipientEmailClient creates a new instance of NotificationRecipientEmailClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewNotificationRecipientEmailClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NotificationRecipientEmailClient, error) { @@ -47,8 +46,8 @@ func NewNotificationRecipientEmailClient(subscriptionID string, credential azcor // CheckEntityExists - Determine if Notification Recipient Email subscribed to the notification. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - notificationName - Notification Name Identifier. // - email - Email identifier. @@ -97,7 +96,7 @@ func (client *NotificationRecipientEmailClient) checkEntityExistsCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -106,8 +105,8 @@ func (client *NotificationRecipientEmailClient) checkEntityExistsCreateRequest(c // CreateOrUpdate - Adds the Email address to the list of Recipients for the Notification. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - notificationName - Notification Name Identifier. // - email - Email identifier. @@ -156,7 +155,7 @@ func (client *NotificationRecipientEmailClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -174,8 +173,8 @@ func (client *NotificationRecipientEmailClient) createOrUpdateHandleResponse(res // Delete - Removes the email from the list of Notification. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - notificationName - Notification Name Identifier. // - email - Email identifier. @@ -224,7 +223,7 @@ func (client *NotificationRecipientEmailClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -233,8 +232,8 @@ func (client *NotificationRecipientEmailClient) deleteCreateRequest(ctx context. // ListByNotification - Gets the list of the Notification Recipient Emails subscribed to a notification. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - notificationName - Notification Name Identifier. // - options - NotificationRecipientEmailClientListByNotificationOptions contains the optional parameters for the NotificationRecipientEmailClient.ListByNotification @@ -278,7 +277,7 @@ func (client *NotificationRecipientEmailClient) listByNotificationCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/notificationrecipientemail_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/notificationrecipientemail_client_example_test.go deleted file mode 100644 index 394ad4b63e71..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/notificationrecipientemail_client_example_test.go +++ /dev/null @@ -1,128 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListNotificationRecipientEmails.json -func ExampleNotificationRecipientEmailClient_ListByNotification() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNotificationRecipientEmailClient().ListByNotification(ctx, "rg1", "apimService1", armapimanagement.NotificationNameRequestPublisherNotificationMessage, 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.RecipientEmailCollection = armapimanagement.RecipientEmailCollection{ - // Count: to.Ptr[int64](3), - // Value: []*armapimanagement.RecipientEmailContract{ - // { - // Name: to.Ptr("contoso@live.com"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications/recipientEmails"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage/recipientEmails/contoso@live.com"), - // Properties: &armapimanagement.RecipientEmailContractProperties{ - // Email: to.Ptr("contoso@live.com"), - // }, - // }, - // { - // Name: to.Ptr("foobar!live"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications/recipientEmails"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage/recipientEmails/foobar!live"), - // Properties: &armapimanagement.RecipientEmailContractProperties{ - // Email: to.Ptr("foobar!live"), - // }, - // }, - // { - // Name: to.Ptr("foobar@live.com"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications/recipientEmails"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage/recipientEmails/foobar@live.com"), - // Properties: &armapimanagement.RecipientEmailContractProperties{ - // Email: to.Ptr("foobar@live.com"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadNotificationRecipientEmail.json -func ExampleNotificationRecipientEmailClient_CheckEntityExists() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewNotificationRecipientEmailClient().CheckEntityExists(ctx, "rg1", "apimService1", armapimanagement.NotificationNameRequestPublisherNotificationMessage, "contoso@live.com", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNotificationRecipientEmail.json -func ExampleNotificationRecipientEmailClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNotificationRecipientEmailClient().CreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.NotificationNameRequestPublisherNotificationMessage, "foobar@live.com", 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.RecipientEmailContract = armapimanagement.RecipientEmailContract{ - // Name: to.Ptr("foobar@live.com"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications/recipientEmails"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage/recipientEmails/foobar@live.com"), - // Properties: &armapimanagement.RecipientEmailContractProperties{ - // Email: to.Ptr("foobar@live.com"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteNotificationRecipientEmail.json -func ExampleNotificationRecipientEmailClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewNotificationRecipientEmailClient().Delete(ctx, "rg1", "apimService1", armapimanagement.NotificationNameRequestPublisherNotificationMessage, "contoso@live.com", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/notificationrecipientuser_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/notificationrecipientuser_client.go index e1775c3fed80..dff9cd5ef242 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/notificationrecipientuser_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/notificationrecipientuser_client.go @@ -29,8 +29,7 @@ type NotificationRecipientUserClient struct { } // NewNotificationRecipientUserClient creates a new instance of NotificationRecipientUserClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewNotificationRecipientUserClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NotificationRecipientUserClient, error) { @@ -47,8 +46,8 @@ func NewNotificationRecipientUserClient(subscriptionID string, credential azcore // CheckEntityExists - Determine if the Notification Recipient User is subscribed to the notification. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - notificationName - Notification Name Identifier. // - userID - User identifier. Must be unique in the current API Management service instance. @@ -97,7 +96,7 @@ func (client *NotificationRecipientUserClient) checkEntityExistsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -106,8 +105,8 @@ func (client *NotificationRecipientUserClient) checkEntityExistsCreateRequest(ct // CreateOrUpdate - Adds the API Management User to the list of Recipients for the Notification. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - notificationName - Notification Name Identifier. // - userID - User identifier. Must be unique in the current API Management service instance. @@ -156,7 +155,7 @@ func (client *NotificationRecipientUserClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -174,8 +173,8 @@ func (client *NotificationRecipientUserClient) createOrUpdateHandleResponse(resp // Delete - Removes the API Management user from the list of Notification. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - notificationName - Notification Name Identifier. // - userID - User identifier. Must be unique in the current API Management service instance. @@ -224,7 +223,7 @@ func (client *NotificationRecipientUserClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -233,8 +232,8 @@ func (client *NotificationRecipientUserClient) deleteCreateRequest(ctx context.C // ListByNotification - Gets the list of the Notification Recipient User subscribed to the notification. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - notificationName - Notification Name Identifier. // - options - NotificationRecipientUserClientListByNotificationOptions contains the optional parameters for the NotificationRecipientUserClient.ListByNotification @@ -278,7 +277,7 @@ func (client *NotificationRecipientUserClient) listByNotificationCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/notificationrecipientuser_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/notificationrecipientuser_client_example_test.go deleted file mode 100644 index cd0e8e7c10be..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/notificationrecipientuser_client_example_test.go +++ /dev/null @@ -1,112 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListNotificationRecipientUsers.json -func ExampleNotificationRecipientUserClient_ListByNotification() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNotificationRecipientUserClient().ListByNotification(ctx, "rg1", "apimService1", armapimanagement.NotificationNameRequestPublisherNotificationMessage, 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.RecipientUserCollection = armapimanagement.RecipientUserCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.RecipientUserContract{ - // { - // Name: to.Ptr("576823d0a40f7e74ec07d642"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications/recipientUsers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage/recipientUsers/576823d0a40f7e74ec07d642"), - // Properties: &armapimanagement.RecipientUsersContractProperties{ - // UserID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/576823d0a40f7e74ec07d642"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadNotificationRecipientUser.json -func ExampleNotificationRecipientUserClient_CheckEntityExists() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewNotificationRecipientUserClient().CheckEntityExists(ctx, "rg1", "apimService1", armapimanagement.NotificationNameRequestPublisherNotificationMessage, "576823d0a40f7e74ec07d642", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNotificationRecipientUser.json -func ExampleNotificationRecipientUserClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNotificationRecipientUserClient().CreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.NotificationNameRequestPublisherNotificationMessage, "576823d0a40f7e74ec07d642", 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.RecipientUserContract = armapimanagement.RecipientUserContract{ - // Name: to.Ptr("576823d0a40f7e74ec07d642"), - // Type: to.Ptr("Microsoft.ApiManagement/service/notifications/recipientUsers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/notifications/RequestPublisherNotificationMessage/recipientUsers/576823d0a40f7e74ec07d642"), - // Properties: &armapimanagement.RecipientUsersContractProperties{ - // UserID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/576823d0a40f7e74ec07d642"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteNotificationRecipientUser.json -func ExampleNotificationRecipientUserClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewNotificationRecipientUserClient().Delete(ctx, "rg1", "apimService1", armapimanagement.NotificationNameRequestPublisherNotificationMessage, "576823d0a40f7e74ec07d642", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/openidconnectprovider_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/openidconnectprovider_client.go index f40b172123a9..efb99fd1b06c 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/openidconnectprovider_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/openidconnectprovider_client.go @@ -30,8 +30,7 @@ type OpenIDConnectProviderClient struct { } // NewOpenIDConnectProviderClient creates a new instance of OpenIDConnectProviderClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewOpenIDConnectProviderClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OpenIDConnectProviderClient, error) { @@ -49,8 +48,8 @@ func NewOpenIDConnectProviderClient(subscriptionID string, credential azcore.Tok // CreateOrUpdate - Creates or updates the OpenID Connect Provider. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - opid - Identifier of the OpenID Connect Provider. // - parameters - Create parameters. @@ -95,7 +94,7 @@ func (client *OpenIDConnectProviderClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -119,8 +118,8 @@ func (client *OpenIDConnectProviderClient) createOrUpdateHandleResponse(resp *ht // Delete - Deletes specific OpenID Connect Provider of the API Management service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - opid - Identifier of the OpenID Connect Provider. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -166,7 +165,7 @@ func (client *OpenIDConnectProviderClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -176,8 +175,8 @@ func (client *OpenIDConnectProviderClient) deleteCreateRequest(ctx context.Conte // Get - Gets specific OpenID Connect Provider without secrets. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - opid - Identifier of the OpenID Connect Provider. // - options - OpenIDConnectProviderClientGetOptions contains the optional parameters for the OpenIDConnectProviderClient.Get @@ -221,7 +220,7 @@ func (client *OpenIDConnectProviderClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -241,8 +240,8 @@ func (client *OpenIDConnectProviderClient) getHandleResponse(resp *http.Response // GetEntityTag - Gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - opid - Identifier of the OpenID Connect Provider. // - options - OpenIDConnectProviderClientGetEntityTagOptions contains the optional parameters for the OpenIDConnectProviderClient.GetEntityTag @@ -286,7 +285,7 @@ func (client *OpenIDConnectProviderClient) getEntityTagCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -304,8 +303,8 @@ func (client *OpenIDConnectProviderClient) getEntityTagHandleResponse(resp *http // NewListByServicePager - Lists of all the OpenId Connect Providers. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - OpenIDConnectProviderClientListByServiceOptions contains the optional parameters for the OpenIDConnectProviderClient.NewListByServicePager // method. @@ -366,7 +365,7 @@ func (client *OpenIDConnectProviderClient) listByServiceCreateRequest(ctx contex if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -384,8 +383,8 @@ func (client *OpenIDConnectProviderClient) listByServiceHandleResponse(resp *htt // ListSecrets - Gets the client secret details of the OpenID Connect Provider. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - opid - Identifier of the OpenID Connect Provider. // - options - OpenIDConnectProviderClientListSecretsOptions contains the optional parameters for the OpenIDConnectProviderClient.ListSecrets @@ -429,7 +428,7 @@ func (client *OpenIDConnectProviderClient) listSecretsCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -450,8 +449,8 @@ func (client *OpenIDConnectProviderClient) listSecretsHandleResponse(resp *http. // Update - Updates the specific OpenID Connect Provider. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - opid - Identifier of the OpenID Connect Provider. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -498,7 +497,7 @@ func (client *OpenIDConnectProviderClient) updateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/openidconnectprovider_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/openidconnectprovider_client_example_test.go deleted file mode 100644 index c1317ce23727..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/openidconnectprovider_client_example_test.go +++ /dev/null @@ -1,222 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListOpenIdConnectProviders.json -func ExampleOpenIDConnectProviderClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOpenIDConnectProviderClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.OpenIDConnectProviderClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.OpenIDConnectProviderCollection = armapimanagement.OpenIDConnectProviderCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.OpenidConnectProviderContract{ - // { - // Name: to.Ptr("templateOpenIdConnect2"), - // Type: to.Ptr("Microsoft.ApiManagement/service/openidconnectproviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/openidConnectProviders/templateOpenIdConnect2"), - // Properties: &armapimanagement.OpenidConnectProviderContractProperties{ - // Description: to.Ptr("open id provider template2"), - // ClientID: to.Ptr("oidprovidertemplate2"), - // DisplayName: to.Ptr("templateoidprovider2"), - // MetadataEndpoint: to.Ptr("https://oidprovider-template2.net"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadOpenIdConnectProvider.json -func ExampleOpenIDConnectProviderClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewOpenIDConnectProviderClient().GetEntityTag(ctx, "rg1", "apimService1", "templateOpenIdConnect2", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetOpenIdConnectProvider.json -func ExampleOpenIDConnectProviderClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOpenIDConnectProviderClient().Get(ctx, "rg1", "apimService1", "templateOpenIdConnect2", 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.OpenidConnectProviderContract = armapimanagement.OpenidConnectProviderContract{ - // Name: to.Ptr("templateOpenIdConnect2"), - // Type: to.Ptr("Microsoft.ApiManagement/service/openidconnectproviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/openidConnectProviders/templateOpenIdConnect2"), - // Properties: &armapimanagement.OpenidConnectProviderContractProperties{ - // Description: to.Ptr("open id provider template2"), - // ClientID: to.Ptr("oidprovidertemplate2"), - // DisplayName: to.Ptr("templateoidprovider2"), - // MetadataEndpoint: to.Ptr("https://oidprovider-template2.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateOpenIdConnectProvider.json -func ExampleOpenIDConnectProviderClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOpenIDConnectProviderClient().CreateOrUpdate(ctx, "rg1", "apimService1", "templateOpenIdConnect3", armapimanagement.OpenidConnectProviderContract{ - Properties: &armapimanagement.OpenidConnectProviderContractProperties{ - ClientID: to.Ptr("oidprovidertemplate3"), - ClientSecret: to.Ptr("x"), - DisplayName: to.Ptr("templateoidprovider3"), - MetadataEndpoint: to.Ptr("https://oidprovider-template3.net"), - }, - }, &armapimanagement.OpenIDConnectProviderClientCreateOrUpdateOptions{IfMatch: 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.OpenidConnectProviderContract = armapimanagement.OpenidConnectProviderContract{ - // Name: to.Ptr("templateOpenIdConnect3"), - // Type: to.Ptr("Microsoft.ApiManagement/service/openidconnectproviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/openidConnectProviders/templateOpenIdConnect3"), - // Properties: &armapimanagement.OpenidConnectProviderContractProperties{ - // ClientID: to.Ptr("oidprovidertemplate3"), - // DisplayName: to.Ptr("templateoidprovider3"), - // MetadataEndpoint: to.Ptr("https://oidprovider-template3.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateOpenIdConnectProvider.json -func ExampleOpenIDConnectProviderClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOpenIDConnectProviderClient().Update(ctx, "rg1", "apimService1", "templateOpenIdConnect2", "*", armapimanagement.OpenidConnectProviderUpdateContract{ - Properties: &armapimanagement.OpenidConnectProviderUpdateContractProperties{ - ClientSecret: to.Ptr("updatedsecret"), - }, - }, 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.OpenidConnectProviderContract = armapimanagement.OpenidConnectProviderContract{ - // Name: to.Ptr("templateOpenIdConnect2"), - // Type: to.Ptr("Microsoft.ApiManagement/service/openidconnectproviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/openidConnectProviders/templateOpenIdConnect2"), - // Properties: &armapimanagement.OpenidConnectProviderContractProperties{ - // Description: to.Ptr("open id provider template2"), - // ClientID: to.Ptr("oidprovidertemplate2"), - // DisplayName: to.Ptr("templateoidprovider2"), - // MetadataEndpoint: to.Ptr("https://oidprovider-template2.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteOpenIdConnectProvider.json -func ExampleOpenIDConnectProviderClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewOpenIDConnectProviderClient().Delete(ctx, "rg1", "apimService1", "templateOpenIdConnect3", "*", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementOpenidConnectProviderListSecrets.json -func ExampleOpenIDConnectProviderClient_ListSecrets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOpenIDConnectProviderClient().ListSecrets(ctx, "rg1", "apimService1", "templateOpenIdConnect2", 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.ClientSecretContract = armapimanagement.ClientSecretContract{ - // ClientSecret: to.Ptr("oidsecretproviderTemplate2"), - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/operation_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/operation_client.go index c833fe730dbe..f73d6de3dc6f 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/operation_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/operation_client.go @@ -30,8 +30,7 @@ type OperationClient struct { } // NewOperationClient creates a new instance of OperationClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewOperationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationClient, error) { @@ -48,8 +47,8 @@ func NewOperationClient(subscriptionID string, credential azcore.TokenCredential // NewListByTagsPager - Lists a collection of operations associated with tags. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -119,7 +118,7 @@ func (client *OperationClient) listByTagsCreateRequest(ctx context.Context, reso if options != nil && options.IncludeNotTaggedOperations != nil { reqQP.Set("includeNotTaggedOperations", strconv.FormatBool(*options.IncludeNotTaggedOperations)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/operation_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/operation_client_example_test.go deleted file mode 100644 index 6f596cc9332c..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/operation_client_example_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiOperationsByTags.json -func ExampleOperationClient_NewListByTagsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationClient().NewListByTagsPager("rg1", "apimService1", "a1", &armapimanagement.OperationClientListByTagsOptions{Filter: nil, - Top: nil, - Skip: nil, - IncludeNotTaggedOperations: 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.TagResourceCollection = armapimanagement.TagResourceCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.TagResourceContract{ - // { - // Operation: &armapimanagement.OperationTagResourceContractProperties{ - // Name: to.Ptr("Create resource"), - // Method: to.Ptr("POST"), - // Description: to.Ptr("A demonstration of a POST call based on the echo backend above. The request body is expected to contain JSON-formatted data (see example below). A policy is used to automatically transform any request sent in JSON directly to XML. In a real-world scenario this could be used to enable modern clients to speak to a legacy backend."), - // APIName: to.Ptr("Echo API"), - // APIRevision: to.Ptr("1"), - // ID: to.Ptr("/apis/echo-api/operations/create-resource"), - // URLTemplate: to.Ptr("/resource"), - // }, - // Tag: &armapimanagement.TagResourceContractProperties{ - // Name: to.Ptr("awesomeTag"), - // ID: to.Ptr("/tags/apitag123"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/operations_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/operations_client.go index 472db7d5457c..4a0a98a6f5b8 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/operations_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/operations_client.go @@ -40,7 +40,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available REST API operations of the Microsoft.ApiManagement provider. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -78,7 +78,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/operations_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/operations_client_example_test.go deleted file mode 100644 index 772620741bfe..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/operations_client_example_test.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListOperations.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armapimanagement.OperationListResult{ - // Value: []*armapimanagement.Operation{ - // { - // Name: to.Ptr("Microsoft.ApiManagement/service/write"), - // Display: &armapimanagement.OperationDisplay{ - // Description: to.Ptr("Create a new instance of API Management Service"), - // Operation: to.Ptr("Create a new instance of API Management Service"), - // Provider: to.Ptr("Microsoft API Management"), - // Resource: to.Ptr("Service"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.ApiManagement/service/read"), - // Display: &armapimanagement.OperationDisplay{ - // Description: to.Ptr("Read metadata for an API Management Service instance"), - // Operation: to.Ptr("Read metadata for an API Management Service instance"), - // Provider: to.Ptr("Microsoft API Management"), - // Resource: to.Ptr("Service"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.ApiManagement/service/delete"), - // Display: &armapimanagement.OperationDisplay{ - // Description: to.Ptr("Delete API Management Service instance"), - // Operation: to.Ptr("Delete API Management Service instance"), - // Provider: to.Ptr("Microsoft API Management"), - // Resource: to.Ptr("Service"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.ApiManagement/service/providers/Microsoft.Insights/diagnosticSettings/write"), - // Display: &armapimanagement.OperationDisplay{ - // Description: to.Ptr("Creates or updates the diagnostic setting for API Management service"), - // Operation: to.Ptr("Write diagnostic setting"), - // Provider: to.Ptr("Microsoft API Management"), - // Resource: to.Ptr("Service"), - // }, - // Origin: to.Ptr("system"), - // }, - // { - // Name: to.Ptr("Microsoft.ApiManagement/service/tenant/operationResults/read"), - // Display: &armapimanagement.OperationDisplay{ - // Description: to.Ptr("Get list of operation results or Get result of a specific operation"), - // Operation: to.Ptr("Get operation results or Get operation result"), - // Provider: to.Ptr("Microsoft API Management"), - // Resource: to.Ptr("Results of async operations"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/outboundnetworkdependenciesendpoints_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/outboundnetworkdependenciesendpoints_client.go index 1d0da7aa6c18..d2001be32a48 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/outboundnetworkdependenciesendpoints_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/outboundnetworkdependenciesendpoints_client.go @@ -29,8 +29,7 @@ type OutboundNetworkDependenciesEndpointsClient struct { } // NewOutboundNetworkDependenciesEndpointsClient creates a new instance of OutboundNetworkDependenciesEndpointsClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewOutboundNetworkDependenciesEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OutboundNetworkDependenciesEndpointsClient, error) { @@ -48,8 +47,8 @@ func NewOutboundNetworkDependenciesEndpointsClient(subscriptionID string, creden // ListByService - Gets the network endpoints of all outbound dependencies of a ApiManagement service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - OutboundNetworkDependenciesEndpointsClientListByServiceOptions contains the optional parameters for the OutboundNetworkDependenciesEndpointsClient.ListByService // method. @@ -88,7 +87,7 @@ func (client *OutboundNetworkDependenciesEndpointsClient) listByServiceCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/outboundnetworkdependenciesendpoints_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/outboundnetworkdependenciesendpoints_client_example_test.go deleted file mode 100644 index 492896e75fc6..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/outboundnetworkdependenciesendpoints_client_example_test.go +++ /dev/null @@ -1,441 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetOutboundNetworkDependenciesEndpoints.json -func ExampleOutboundNetworkDependenciesEndpointsClient_ListByService() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOutboundNetworkDependenciesEndpointsClient().ListByService(ctx, "rg1", "apimService1", 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.OutboundEnvironmentEndpointList = armapimanagement.OutboundEnvironmentEndpointList{ - // Value: []*armapimanagement.OutboundEnvironmentEndpoint{ - // { - // Category: to.Ptr("Azure SMTP"), - // Endpoints: []*armapimanagement.EndpointDependency{ - // { - // DomainName: to.Ptr("smtpi-ch1.msn.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](25028), - // Region: to.Ptr("West US"), - // }}, - // }}, - // }, - // { - // Category: to.Ptr("Azure SQL"), - // Endpoints: []*armapimanagement.EndpointDependency{ - // { - // DomainName: to.Ptr("xxxx1345234.database.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](1433), - // Region: to.Ptr("West US"), - // }}, - // }}, - // }, - // { - // Category: to.Ptr("Azure Storage"), - // Endpoints: []*armapimanagement.EndpointDependency{ - // { - // DomainName: to.Ptr("xxxx32storagedgfbay.blob.core.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx1362629927xt.blob.core.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx1362629927xt.table.core.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx141483183xt.blob.core.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx141483183xt.table.core.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx1949864718xt.blob.core.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx1949864718xt.table.core.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx3292114122xt.blob.core.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx3292114122xt.table.core.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx32tst4oto8t0mlesawmm.blob.core.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx32tst4oto8t0mlesawmm.file.core.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](445), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx32tst4oto8t0mlesawmm.queue.core.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx32tst4oto8t0mlesawmm.table.core.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }}, - // }}, - // }, - // { - // Category: to.Ptr("Azure Event Hub"), - // Endpoints: []*armapimanagement.EndpointDependency{ - // { - // DomainName: to.Ptr("xxxx1362629927eh.servicebus.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }, - // { - // Port: to.Ptr[int32](5671), - // Region: to.Ptr("West US"), - // }, - // { - // Port: to.Ptr[int32](5672), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx1949864718eh.servicebus.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }, - // { - // Port: to.Ptr[int32](5671), - // Region: to.Ptr("West US"), - // }, - // { - // Port: to.Ptr[int32](5672), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx3292114122eh.servicebus.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }, - // { - // Port: to.Ptr[int32](5671), - // Region: to.Ptr("West US"), - // }, - // { - // Port: to.Ptr[int32](5672), - // Region: to.Ptr("West US"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxxx141483183eh.servicebus.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("West US"), - // }, - // { - // Port: to.Ptr[int32](5671), - // Region: to.Ptr("West US"), - // }, - // { - // Port: to.Ptr[int32](5672), - // Region: to.Ptr("West US"), - // }}, - // }}, - // }, - // { - // Category: to.Ptr("SSL Certificate Verification"), - // Endpoints: []*armapimanagement.EndpointDependency{ - // { - // DomainName: to.Ptr("ocsp.msocsp.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](80), - // Region: to.Ptr("Global"), - // }, - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("mscrl.microsoft.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](80), - // Region: to.Ptr("Global"), - // }, - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("crl.microsoft.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](80), - // Region: to.Ptr("Global"), - // }, - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("crl3.digicert.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](80), - // Region: to.Ptr("Global"), - // }, - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("ocsp.digicert.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](80), - // Region: to.Ptr("Global"), - // }, - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("cacerts.digicert.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](80), - // Region: to.Ptr("Global"), - // }, - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }}, - // }, - // { - // Category: to.Ptr("Azure Monitor"), - // Endpoints: []*armapimanagement.EndpointDependency{ - // { - // DomainName: to.Ptr("gcs.ppe.monitoring.core.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("global.prod.microsoftmetrics.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxx3.prod.microsoftmetrics.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](1886), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxx3-red.prod.microsoftmetrics.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](1886), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("xxx3-black.prod.microsoftmetrics.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](1886), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("gcs.ppe.warm.ingestion.monitoring.azure.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("metrichost23.prod.microsoftmetrics.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("metrichost23-red.prod.microsoftmetrics.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("metrichost23-black.prod.microsoftmetrics.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }}, - // }, - // { - // Category: to.Ptr("Portal Captcha"), - // Endpoints: []*armapimanagement.EndpointDependency{ - // { - // DomainName: to.Ptr("client.xxx.live.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("partner.xxx.live.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }}, - // }, - // { - // Category: to.Ptr("Azure Active Directory"), - // Endpoints: []*armapimanagement.EndpointDependency{ - // { - // DomainName: to.Ptr("login.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("graph.windows.net"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }, - // { - // DomainName: to.Ptr("login.microsoftonline.com"), - // EndpointDetails: []*armapimanagement.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // Region: to.Ptr("Global"), - // }}, - // }}, - // }}, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/policy_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/policy_client.go index ff25d6f5223d..2d3165350a3c 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/policy_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/policy_client.go @@ -29,8 +29,7 @@ type PolicyClient struct { } // NewPolicyClient creates a new instance of PolicyClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPolicyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PolicyClient, error) { @@ -48,8 +47,8 @@ func NewPolicyClient(subscriptionID string, credential azcore.TokenCredential, o // CreateOrUpdate - Creates or updates the global policy configuration of the Api Management service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - policyID - The identifier of the Policy. // - parameters - The policy contents to apply. @@ -93,7 +92,7 @@ func (client *PolicyClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -117,8 +116,8 @@ func (client *PolicyClient) createOrUpdateHandleResponse(resp *http.Response) (P // Delete - Deletes the global policy configuration of the Api Management Service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - policyID - The identifier of the Policy. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -163,7 +162,7 @@ func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -173,8 +172,8 @@ func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Get the Global policy definition of the Api Management service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - policyID - The identifier of the Policy. // - options - PolicyClientGetOptions contains the optional parameters for the PolicyClient.Get method. @@ -220,7 +219,7 @@ func (client *PolicyClient) getCreateRequest(ctx context.Context, resourceGroupN if options != nil && options.Format != nil { reqQP.Set("format", string(*options.Format)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,8 +239,8 @@ func (client *PolicyClient) getHandleResponse(resp *http.Response) (PolicyClient // GetEntityTag - Gets the entity state (Etag) version of the Global policy definition in the Api Management service. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - policyID - The identifier of the Policy. // - options - PolicyClientGetEntityTagOptions contains the optional parameters for the PolicyClient.GetEntityTag method. @@ -284,7 +283,7 @@ func (client *PolicyClient) getEntityTagCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -300,26 +299,39 @@ func (client *PolicyClient) getEntityTagHandleResponse(resp *http.Response) (Pol return result, nil } -// ListByService - Lists all the Global Policy definitions of the Api Management service. -// If the operation fails it returns an *azcore.ResponseError type. +// NewListByServicePager - Lists all the Global Policy definitions of the Api Management service. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. -// - options - PolicyClientListByServiceOptions contains the optional parameters for the PolicyClient.ListByService method. -func (client *PolicyClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, options *PolicyClientListByServiceOptions) (PolicyClientListByServiceResponse, error) { - req, err := client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, options) - if err != nil { - return PolicyClientListByServiceResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PolicyClientListByServiceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PolicyClientListByServiceResponse{}, runtime.NewResponseError(resp) - } - return client.listByServiceHandleResponse(resp) +// - options - PolicyClientListByServiceOptions contains the optional parameters for the PolicyClient.NewListByServicePager +// method. +func (client *PolicyClient) NewListByServicePager(resourceGroupName string, serviceName string, options *PolicyClientListByServiceOptions) *runtime.Pager[PolicyClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[PolicyClientListByServiceResponse]{ + More: func(page PolicyClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PolicyClientListByServiceResponse) (PolicyClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PolicyClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PolicyClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PolicyClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) } // listByServiceCreateRequest creates the ListByService request. @@ -342,7 +354,7 @@ func (client *PolicyClient) listByServiceCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/policy_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/policy_client_example_test.go deleted file mode 100644 index 9ea92bf940bc..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/policy_client_example_test.go +++ /dev/null @@ -1,175 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPolicies.json -func ExamplePolicyClient_ListByService() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPolicyClient().ListByService(ctx, "rg1", "apimService1", 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.PolicyCollection = armapimanagement.PolicyCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.PolicyContract{ - // { - // Name: to.Ptr("policy"), - // Type: to.Ptr("Microsoft.ApiManagement/service/policies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policies/policy"), - // Properties: &armapimanagement.PolicyContractProperties{ - // Value: to.Ptr("\r\n\r\n \r\n \r\n \r\n \r\n \r\n"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadPolicy.json -func ExamplePolicyClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewPolicyClient().GetEntityTag(ctx, "rg1", "apimService1", armapimanagement.PolicyIDNamePolicy, 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPolicy.json -func ExamplePolicyClient_Get_apiManagementGetPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPolicyClient().Get(ctx, "rg1", "apimService1", armapimanagement.PolicyIDNamePolicy, &armapimanagement.PolicyClientGetOptions{Format: 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.PolicyContract = armapimanagement.PolicyContract{ - // Name: to.Ptr("policy"), - // Type: to.Ptr("Microsoft.ApiManagement/service/policies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policies/policy"), - // Properties: &armapimanagement.PolicyContractProperties{ - // Value: to.Ptr("\r\n\r\n \r\n \r\n \r\n \r\n \r\n"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPolicyFormat.json -func ExamplePolicyClient_Get_apiManagementGetPolicyFormat() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPolicyClient().Get(ctx, "rg1", "apimService1", armapimanagement.PolicyIDNamePolicy, &armapimanagement.PolicyClientGetOptions{Format: to.Ptr(armapimanagement.PolicyExportFormatRawxml)}) - 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.PolicyContract = armapimanagement.PolicyContract{ - // Name: to.Ptr("policy"), - // Type: to.Ptr("Microsoft.ApiManagement/service/policies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policies/policy"), - // Properties: &armapimanagement.PolicyContractProperties{ - // Format: to.Ptr(armapimanagement.PolicyContentFormatRawxml), - // Value: to.Ptr("\r\n\r\n \r\n \r\n @{\n var guidBinary = new byte[16];\n Array.Copy(Guid.NewGuid().ToByteArray(), 0, guidBinary, 0, 10);\n long time = DateTime.Now.Ticks;\n byte[] bytes = new byte[6];\n unchecked\n {\n bytes[5] = (byte)(time >> 40);\n bytes[4] = (byte)(time >> 32);\n bytes[3] = (byte)(time >> 24);\n bytes[2] = (byte)(time >> 16);\n bytes[1] = (byte)(time >> 8);\n bytes[0] = (byte)(time);\n }\n Array.Copy(bytes, 0, guidBinary, 10, 6);\n return new Guid(guidBinary).ToString();\n }\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreatePolicy.json -func ExamplePolicyClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPolicyClient().CreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.PolicyIDNamePolicy, armapimanagement.PolicyContract{ - Properties: &armapimanagement.PolicyContractProperties{ - Format: to.Ptr(armapimanagement.PolicyContentFormatXML), - Value: to.Ptr("\r\n \r\n \r\n \r\n \r\n \r\n"), - }, - }, &armapimanagement.PolicyClientCreateOrUpdateOptions{IfMatch: 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.PolicyContract = armapimanagement.PolicyContract{ - // Name: to.Ptr("policy"), - // Type: to.Ptr("Microsoft.ApiManagement/service/policies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policies/policy"), - // Properties: &armapimanagement.PolicyContractProperties{ - // Value: to.Ptr("\r\n \r\n \r\n \r\n \r\n \r\n"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeletePolicy.json -func ExamplePolicyClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewPolicyClient().Delete(ctx, "rg1", "apimService1", armapimanagement.PolicyIDNamePolicy, "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/policydescription_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/policydescription_client.go index e65a69bdaa9c..6ba6919bcd1e 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/policydescription_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/policydescription_client.go @@ -29,8 +29,7 @@ type PolicyDescriptionClient struct { } // NewPolicyDescriptionClient creates a new instance of PolicyDescriptionClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPolicyDescriptionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PolicyDescriptionClient, error) { @@ -48,8 +47,8 @@ func NewPolicyDescriptionClient(subscriptionID string, credential azcore.TokenCr // ListByService - Lists all policy descriptions. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - PolicyDescriptionClientListByServiceOptions contains the optional parameters for the PolicyDescriptionClient.ListByService // method. @@ -91,7 +90,7 @@ func (client *PolicyDescriptionClient) listByServiceCreateRequest(ctx context.Co if options != nil && options.Scope != nil { reqQP.Set("scope", string(*options.Scope)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/policydescription_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/policydescription_client_example_test.go deleted file mode 100644 index 0c638f7050a2..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/policydescription_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPolicyDescriptions.json -func ExamplePolicyDescriptionClient_ListByService() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPolicyDescriptionClient().ListByService(ctx, "rg1", "apimService1", &armapimanagement.PolicyDescriptionClientListByServiceOptions{Scope: to.Ptr(armapimanagement.PolicyScopeContractAPI)}) - 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.PolicyDescriptionCollection = armapimanagement.PolicyDescriptionCollection{ - // Count: to.Ptr[int64](2), - // Value: []*armapimanagement.PolicyDescriptionContract{ - // { - // Name: to.Ptr("authentication-basic"), - // Type: to.Ptr("Microsoft.ApiManagement/service/policyDescriptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policyDescriptions/authentication-basic"), - // Properties: &armapimanagement.PolicyDescriptionContractProperties{ - // Description: to.Ptr("Authenticate with the backend service using Basic authentication. Use in the inbound section at API scope."), - // Scope: to.Ptr[int64](268435471), - // }, - // }, - // { - // Name: to.Ptr("authentication-certificate"), - // Type: to.Ptr("Microsoft.ApiManagement/service/policyDescriptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policyDescriptions/authentication-certificate"), - // Properties: &armapimanagement.PolicyDescriptionContractProperties{ - // Description: to.Ptr("Authenticate with the backend service using a client certificate. Use in the inbound section at API scope."), - // Scope: to.Ptr[int64](268435471), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/policyfragment_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/policyfragment_client.go new file mode 100644 index 000000000000..508fb3a99c54 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/policyfragment_client.go @@ -0,0 +1,460 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// PolicyFragmentClient contains the methods for the PolicyFragment group. +// Don't use this type directly, use NewPolicyFragmentClient() instead. +type PolicyFragmentClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPolicyFragmentClient creates a new instance of PolicyFragmentClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPolicyFragmentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PolicyFragmentClient, error) { + cl, err := arm.NewClient(moduleName+".PolicyFragmentClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PolicyFragmentClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a policy fragment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - id - A resource identifier. +// - parameters - The policy fragment contents to apply. +// - options - PolicyFragmentClientBeginCreateOrUpdateOptions contains the optional parameters for the PolicyFragmentClient.BeginCreateOrUpdate +// method. +func (client *PolicyFragmentClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, id string, parameters PolicyFragmentContract, options *PolicyFragmentClientBeginCreateOrUpdateOptions) (*runtime.Poller[PolicyFragmentClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serviceName, id, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PolicyFragmentClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PolicyFragmentClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates a policy fragment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +func (client *PolicyFragmentClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, id string, parameters PolicyFragmentContract, options *PolicyFragmentClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, id, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PolicyFragmentClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, id string, parameters PolicyFragmentContract, options *PolicyFragmentClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// Delete - Deletes a policy fragment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - id - A resource identifier. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - PolicyFragmentClientDeleteOptions contains the optional parameters for the PolicyFragmentClient.Delete method. +func (client *PolicyFragmentClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, id string, ifMatch string, options *PolicyFragmentClientDeleteOptions) (PolicyFragmentClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, id, ifMatch, options) + if err != nil { + return PolicyFragmentClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PolicyFragmentClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return PolicyFragmentClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return PolicyFragmentClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PolicyFragmentClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, id string, ifMatch string, options *PolicyFragmentClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a policy fragment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - id - A resource identifier. +// - options - PolicyFragmentClientGetOptions contains the optional parameters for the PolicyFragmentClient.Get method. +func (client *PolicyFragmentClient) Get(ctx context.Context, resourceGroupName string, serviceName string, id string, options *PolicyFragmentClientGetOptions) (PolicyFragmentClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, id, options) + if err != nil { + return PolicyFragmentClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PolicyFragmentClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PolicyFragmentClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PolicyFragmentClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, id string, options *PolicyFragmentClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + 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", "2023-03-01-preview") + if options != nil && options.Format != nil { + reqQP.Set("format", string(*options.Format)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PolicyFragmentClient) getHandleResponse(resp *http.Response) (PolicyFragmentClientGetResponse, error) { + result := PolicyFragmentClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyFragmentContract); err != nil { + return PolicyFragmentClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of a policy fragment. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - id - A resource identifier. +// - options - PolicyFragmentClientGetEntityTagOptions contains the optional parameters for the PolicyFragmentClient.GetEntityTag +// method. +func (client *PolicyFragmentClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, id string, options *PolicyFragmentClientGetEntityTagOptions) (PolicyFragmentClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, id, options) + if err != nil { + return PolicyFragmentClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PolicyFragmentClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PolicyFragmentClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *PolicyFragmentClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, id string, options *PolicyFragmentClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *PolicyFragmentClient) getEntityTagHandleResponse(resp *http.Response) (PolicyFragmentClientGetEntityTagResponse, error) { + result := PolicyFragmentClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByServicePager - Gets all policy fragments. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - options - PolicyFragmentClientListByServiceOptions contains the optional parameters for the PolicyFragmentClient.NewListByServicePager +// method. +func (client *PolicyFragmentClient) NewListByServicePager(resourceGroupName string, serviceName string, options *PolicyFragmentClientListByServiceOptions) *runtime.Pager[PolicyFragmentClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[PolicyFragmentClientListByServiceResponse]{ + More: func(page PolicyFragmentClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PolicyFragmentClientListByServiceResponse) (PolicyFragmentClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PolicyFragmentClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PolicyFragmentClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PolicyFragmentClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PolicyFragmentClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *PolicyFragmentClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + 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", "2023-03-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PolicyFragmentClient) listByServiceHandleResponse(resp *http.Response) (PolicyFragmentClientListByServiceResponse, error) { + result := PolicyFragmentClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyFragmentCollection); err != nil { + return PolicyFragmentClientListByServiceResponse{}, err + } + return result, nil +} + +// ListReferences - Lists policy resources that reference the policy fragment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - id - A resource identifier. +// - options - PolicyFragmentClientListReferencesOptions contains the optional parameters for the PolicyFragmentClient.ListReferences +// method. +func (client *PolicyFragmentClient) ListReferences(ctx context.Context, resourceGroupName string, serviceName string, id string, options *PolicyFragmentClientListReferencesOptions) (PolicyFragmentClientListReferencesResponse, error) { + req, err := client.listReferencesCreateRequest(ctx, resourceGroupName, serviceName, id, options) + if err != nil { + return PolicyFragmentClientListReferencesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PolicyFragmentClientListReferencesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PolicyFragmentClientListReferencesResponse{}, runtime.NewResponseError(resp) + } + return client.listReferencesHandleResponse(resp) +} + +// listReferencesCreateRequest creates the ListReferences request. +func (client *PolicyFragmentClient) listReferencesCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, id string, options *PolicyFragmentClientListReferencesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}/listReferences" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listReferencesHandleResponse handles the ListReferences response. +func (client *PolicyFragmentClient) listReferencesHandleResponse(resp *http.Response) (PolicyFragmentClientListReferencesResponse, error) { + result := PolicyFragmentClientListReferencesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceCollection); err != nil { + return PolicyFragmentClientListReferencesResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/portalconfig_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/portalconfig_client.go new file mode 100644 index 000000000000..e88302f38d00 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/portalconfig_client.go @@ -0,0 +1,376 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PortalConfigClient contains the methods for the PortalConfig group. +// Don't use this type directly, use NewPortalConfigClient() instead. +type PortalConfigClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPortalConfigClient creates a new instance of PortalConfigClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPortalConfigClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PortalConfigClient, error) { + cl, err := arm.NewClient(moduleName+".PortalConfigClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PortalConfigClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create or update the developer portal configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - portalConfigID - Portal configuration identifier. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - Update the developer portal configuration. +// - options - PortalConfigClientCreateOrUpdateOptions contains the optional parameters for the PortalConfigClient.CreateOrUpdate +// method. +func (client *PortalConfigClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, portalConfigID string, ifMatch string, parameters PortalConfigContract, options *PortalConfigClientCreateOrUpdateOptions) (PortalConfigClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, portalConfigID, ifMatch, parameters, options) + if err != nil { + return PortalConfigClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PortalConfigClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PortalConfigClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PortalConfigClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, portalConfigID string, ifMatch string, parameters PortalConfigContract, options *PortalConfigClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" + 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 serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if portalConfigID == "" { + return nil, errors.New("parameter portalConfigID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{portalConfigId}", url.PathEscape(portalConfigID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *PortalConfigClient) createOrUpdateHandleResponse(resp *http.Response) (PortalConfigClientCreateOrUpdateResponse, error) { + result := PortalConfigClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PortalConfigContract); err != nil { + return PortalConfigClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Get - Get the developer portal configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - portalConfigID - Portal configuration identifier. +// - options - PortalConfigClientGetOptions contains the optional parameters for the PortalConfigClient.Get method. +func (client *PortalConfigClient) Get(ctx context.Context, resourceGroupName string, serviceName string, portalConfigID string, options *PortalConfigClientGetOptions) (PortalConfigClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, portalConfigID, options) + if err != nil { + return PortalConfigClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PortalConfigClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PortalConfigClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PortalConfigClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, portalConfigID string, options *PortalConfigClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" + 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 serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if portalConfigID == "" { + return nil, errors.New("parameter portalConfigID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{portalConfigId}", url.PathEscape(portalConfigID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PortalConfigClient) getHandleResponse(resp *http.Response) (PortalConfigClientGetResponse, error) { + result := PortalConfigClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PortalConfigContract); err != nil { + return PortalConfigClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the developer portal configuration. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - portalConfigID - Portal configuration identifier. +// - options - PortalConfigClientGetEntityTagOptions contains the optional parameters for the PortalConfigClient.GetEntityTag +// method. +func (client *PortalConfigClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, portalConfigID string, options *PortalConfigClientGetEntityTagOptions) (PortalConfigClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, portalConfigID, options) + if err != nil { + return PortalConfigClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PortalConfigClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PortalConfigClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *PortalConfigClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, portalConfigID string, options *PortalConfigClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" + 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 serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if portalConfigID == "" { + return nil, errors.New("parameter portalConfigID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{portalConfigId}", url.PathEscape(portalConfigID)) + req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *PortalConfigClient) getEntityTagHandleResponse(resp *http.Response) (PortalConfigClientGetEntityTagResponse, error) { + result := PortalConfigClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByServicePager - Lists the developer portal configurations. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - options - PortalConfigClientListByServiceOptions contains the optional parameters for the PortalConfigClient.NewListByServicePager +// method. +func (client *PortalConfigClient) NewListByServicePager(resourceGroupName string, serviceName string, options *PortalConfigClientListByServiceOptions) *runtime.Pager[PortalConfigClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[PortalConfigClientListByServiceResponse]{ + More: func(page PortalConfigClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PortalConfigClientListByServiceResponse) (PortalConfigClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PortalConfigClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PortalConfigClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PortalConfigClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PortalConfigClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *PortalConfigClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PortalConfigClient) listByServiceHandleResponse(resp *http.Response) (PortalConfigClientListByServiceResponse, error) { + result := PortalConfigClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PortalConfigCollection); err != nil { + return PortalConfigClientListByServiceResponse{}, err + } + return result, nil +} + +// Update - Update the developer portal configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - portalConfigID - Portal configuration identifier. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - Update the developer portal configuration. +// - options - PortalConfigClientUpdateOptions contains the optional parameters for the PortalConfigClient.Update method. +func (client *PortalConfigClient) Update(ctx context.Context, resourceGroupName string, serviceName string, portalConfigID string, ifMatch string, parameters PortalConfigContract, options *PortalConfigClientUpdateOptions) (PortalConfigClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, portalConfigID, ifMatch, parameters, options) + if err != nil { + return PortalConfigClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PortalConfigClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PortalConfigClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *PortalConfigClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, portalConfigID string, ifMatch string, parameters PortalConfigContract, options *PortalConfigClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}" + 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 serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if portalConfigID == "" { + return nil, errors.New("parameter portalConfigID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{portalConfigId}", url.PathEscape(portalConfigID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *PortalConfigClient) updateHandleResponse(resp *http.Response) (PortalConfigClientUpdateResponse, error) { + result := PortalConfigClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PortalConfigContract); err != nil { + return PortalConfigClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/portalrevision_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/portalrevision_client.go index 04beae0b6fb1..d607910da80c 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/portalrevision_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/portalrevision_client.go @@ -30,8 +30,7 @@ type PortalRevisionClient struct { } // NewPortalRevisionClient creates a new instance of PortalRevisionClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPortalRevisionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PortalRevisionClient, error) { @@ -50,8 +49,8 @@ func NewPortalRevisionClient(subscriptionID string, credential azcore.TokenCrede // indicates if the revision is publicly accessible. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - portalRevisionID - Portal revision identifier. Must be unique in the current API Management service instance. // - options - PortalRevisionClientBeginCreateOrUpdateOptions contains the optional parameters for the PortalRevisionClient.BeginCreateOrUpdate @@ -74,7 +73,7 @@ func (client *PortalRevisionClient) BeginCreateOrUpdate(ctx context.Context, res // if the revision is publicly accessible. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *PortalRevisionClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, portalRevisionID string, parameters PortalRevisionContract, options *PortalRevisionClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, portalRevisionID, parameters, options) if err != nil { @@ -114,7 +113,7 @@ func (client *PortalRevisionClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -123,8 +122,8 @@ func (client *PortalRevisionClient) createOrUpdateCreateRequest(ctx context.Cont // Get - Gets the developer portal's revision specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - portalRevisionID - Portal revision identifier. Must be unique in the current API Management service instance. // - options - PortalRevisionClientGetOptions contains the optional parameters for the PortalRevisionClient.Get method. @@ -167,7 +166,7 @@ func (client *PortalRevisionClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -187,8 +186,8 @@ func (client *PortalRevisionClient) getHandleResponse(resp *http.Response) (Port // GetEntityTag - Gets the developer portal revision specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - portalRevisionID - Portal revision identifier. Must be unique in the current API Management service instance. // - options - PortalRevisionClientGetEntityTagOptions contains the optional parameters for the PortalRevisionClient.GetEntityTag @@ -232,7 +231,7 @@ func (client *PortalRevisionClient) getEntityTagCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,8 +249,8 @@ func (client *PortalRevisionClient) getEntityTagHandleResponse(resp *http.Respon // NewListByServicePager - Lists developer portal's revisions. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - PortalRevisionClientListByServiceOptions contains the optional parameters for the PortalRevisionClient.NewListByServicePager // method. @@ -312,7 +311,7 @@ func (client *PortalRevisionClient) listByServiceCreateRequest(ctx context.Conte if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,8 +329,8 @@ func (client *PortalRevisionClient) listByServiceHandleResponse(resp *http.Respo // BeginUpdate - Updates the description of specified portal revision or makes it current. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - portalRevisionID - Portal revision identifier. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -355,7 +354,7 @@ func (client *PortalRevisionClient) BeginUpdate(ctx context.Context, resourceGro // Update - Updates the description of specified portal revision or makes it current. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *PortalRevisionClient) update(ctx context.Context, resourceGroupName string, serviceName string, portalRevisionID string, ifMatch string, parameters PortalRevisionContract, options *PortalRevisionClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, portalRevisionID, ifMatch, parameters, options) if err != nil { @@ -395,7 +394,7 @@ func (client *PortalRevisionClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/portalrevision_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/portalrevision_client_example_test.go deleted file mode 100644 index 54d365279c35..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/portalrevision_client_example_test.go +++ /dev/null @@ -1,190 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPortalRevisions.json -func ExamplePortalRevisionClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPortalRevisionClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.PortalRevisionClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.PortalRevisionCollection = armapimanagement.PortalRevisionCollection{ - // Value: []*armapimanagement.PortalRevisionContract{ - // { - // Name: to.Ptr("20201112000000"), - // Type: to.Ptr("Microsoft.ApiManagement/service/portalRevisions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/portalRevisions/20201112000000"), - // Properties: &armapimanagement.PortalRevisionContractProperties{ - // Description: to.Ptr("portal revision"), - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-12T22:10:09.673Z"); return t}()), - // IsCurrent: to.Ptr(false), - // Status: to.Ptr(armapimanagement.PortalRevisionStatusCompleted), - // UpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-12T22:12:41.46Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("20201112101010"), - // Type: to.Ptr("Microsoft.ApiManagement/service/portalRevisions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/portalRevisions/20201112101010"), - // Properties: &armapimanagement.PortalRevisionContractProperties{ - // Description: to.Ptr("portal revision 1"), - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-12T22:51:36.47Z"); return t}()), - // IsCurrent: to.Ptr(true), - // Status: to.Ptr(armapimanagement.PortalRevisionStatusCompleted), - // UpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-12T22:52:00.097Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadPortalRevision.json -func ExamplePortalRevisionClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewPortalRevisionClient().GetEntityTag(ctx, "rg1", "apimService1", "20201112101010", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPortalRevision.json -func ExamplePortalRevisionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPortalRevisionClient().Get(ctx, "rg1", "apimService1", "20201112101010", 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.PortalRevisionContract = armapimanagement.PortalRevisionContract{ - // Name: to.Ptr("20201112101010"), - // Type: to.Ptr("Microsoft.ApiManagement/service/portalRevisions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/portalRevisions/20201112101010"), - // Properties: &armapimanagement.PortalRevisionContractProperties{ - // Description: to.Ptr("portal revision 1"), - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-12T22:51:36.47Z"); return t}()), - // IsCurrent: to.Ptr(true), - // Status: to.Ptr(armapimanagement.PortalRevisionStatusCompleted), - // UpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-12T22:52:00.097Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreatePortalRevision.json -func ExamplePortalRevisionClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPortalRevisionClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "20201112101010", armapimanagement.PortalRevisionContract{ - Properties: &armapimanagement.PortalRevisionContractProperties{ - Description: to.Ptr("portal revision 1"), - IsCurrent: 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdatePortalRevision.json -func ExamplePortalRevisionClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPortalRevisionClient().BeginUpdate(ctx, "rg1", "apimService1", "20201112101010", "*", armapimanagement.PortalRevisionContract{ - Properties: &armapimanagement.PortalRevisionContractProperties{ - Description: to.Ptr("portal revision update"), - IsCurrent: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PortalRevisionContract = armapimanagement.PortalRevisionContract{ - // Name: to.Ptr("20201112101010"), - // Type: to.Ptr("Microsoft.ApiManagement/service/portalRevisions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/namedValues/testprop2"), - // Properties: &armapimanagement.PortalRevisionContractProperties{ - // Description: to.Ptr("portal revision update"), - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-13T22:47:13.397Z"); return t}()), - // IsCurrent: to.Ptr(true), - // Status: to.Ptr(armapimanagement.PortalRevisionStatusCompleted), - // UpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-13T23:29:25.34Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/portalsettings_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/portalsettings_client.go index 734a4527066a..05eb8cc234bc 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/portalsettings_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/portalsettings_client.go @@ -29,8 +29,7 @@ type PortalSettingsClient struct { } // NewPortalSettingsClient creates a new instance of PortalSettingsClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPortalSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PortalSettingsClient, error) { @@ -48,8 +47,8 @@ func NewPortalSettingsClient(subscriptionID string, credential azcore.TokenCrede // ListByService - Lists a collection of portalsettings defined within a service instance.. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - PortalSettingsClientListByServiceOptions contains the optional parameters for the PortalSettingsClient.ListByService // method. @@ -88,7 +87,7 @@ func (client *PortalSettingsClient) listByServiceCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/portalsettings_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/portalsettings_client_example_test.go deleted file mode 100644 index df61edb03613..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/portalsettings_client_example_test.go +++ /dev/null @@ -1,77 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPortalSettings.json -func ExamplePortalSettingsClient_ListByService() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPortalSettingsClient().ListByService(ctx, "rg1", "apimService1", 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.PortalSettingsCollection = armapimanagement.PortalSettingsCollection{ - // Count: to.Ptr[int64](3), - // Value: []*armapimanagement.PortalSettingsContract{ - // { - // Name: to.Ptr("delegation"), - // Type: to.Ptr("Microsoft.ApiManagement/service/portalsettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/portalsettings/delegation"), - // Properties: &armapimanagement.PortalSettingsContractProperties{ - // Enabled: to.Ptr(false), - // Subscriptions: &armapimanagement.SubscriptionsDelegationSettingsProperties{ - // Enabled: to.Ptr(false), - // }, - // UserRegistration: &armapimanagement.RegistrationDelegationSettingsProperties{ - // Enabled: to.Ptr(false), - // }, - // }, - // }, - // { - // Name: to.Ptr("signin"), - // Type: to.Ptr("Microsoft.ApiManagement/service/portalsettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/portalsettings/signin"), - // Properties: &armapimanagement.PortalSettingsContractProperties{ - // Enabled: to.Ptr(false), - // }, - // }, - // { - // Name: to.Ptr("signup"), - // Type: to.Ptr("Microsoft.ApiManagement/service/portalsettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/portalsettings/signup"), - // Properties: &armapimanagement.PortalSettingsContractProperties{ - // Enabled: to.Ptr(true), - // TermsOfService: &armapimanagement.TermsOfServiceProperties{ - // ConsentRequired: to.Ptr(false), - // Enabled: to.Ptr(false), - // Text: to.Ptr("Terms of service"), - // }, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/privateendpointconnection_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/privateendpointconnection_client.go index 57cc2140be74..86e739084b1b 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/privateendpointconnection_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/privateendpointconnection_client.go @@ -29,8 +29,7 @@ type PrivateEndpointConnectionClient struct { } // NewPrivateEndpointConnectionClient creates a new instance of PrivateEndpointConnectionClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateEndpointConnectionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionClient, error) { @@ -48,8 +47,8 @@ func NewPrivateEndpointConnectionClient(subscriptionID string, credential azcore // BeginCreateOrUpdate - Creates a new Private Endpoint Connection or updates an existing one. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - privateEndpointConnectionName - Name of the private endpoint connection. // - options - PrivateEndpointConnectionClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionClient.BeginCreateOrUpdate @@ -69,7 +68,7 @@ func (client *PrivateEndpointConnectionClient) BeginCreateOrUpdate(ctx context.C // CreateOrUpdate - Creates a new Private Endpoint Connection or updates an existing one. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *PrivateEndpointConnectionClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, privateEndpointConnectionName string, privateEndpointConnectionRequest PrivateEndpointConnectionRequest, options *PrivateEndpointConnectionClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, privateEndpointConnectionName, privateEndpointConnectionRequest, options) if err != nil { @@ -109,7 +108,7 @@ func (client *PrivateEndpointConnectionClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, privateEndpointConnectionRequest) @@ -118,8 +117,8 @@ func (client *PrivateEndpointConnectionClient) createOrUpdateCreateRequest(ctx c // BeginDelete - Deletes the specified Private Endpoint Connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - privateEndpointConnectionName - Name of the private endpoint connection. // - options - PrivateEndpointConnectionClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionClient.BeginDelete @@ -139,7 +138,7 @@ func (client *PrivateEndpointConnectionClient) BeginDelete(ctx context.Context, // Delete - Deletes the specified Private Endpoint Connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *PrivateEndpointConnectionClient) deleteOperation(ctx context.Context, resourceGroupName string, serviceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, privateEndpointConnectionName, options) if err != nil { @@ -179,7 +178,7 @@ func (client *PrivateEndpointConnectionClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,8 +187,8 @@ func (client *PrivateEndpointConnectionClient) deleteCreateRequest(ctx context.C // GetByName - Gets the details of the Private Endpoint Connection specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - privateEndpointConnectionName - Name of the private endpoint connection. // - options - PrivateEndpointConnectionClientGetByNameOptions contains the optional parameters for the PrivateEndpointConnectionClient.GetByName @@ -233,7 +232,7 @@ func (client *PrivateEndpointConnectionClient) getByNameCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,8 +250,8 @@ func (client *PrivateEndpointConnectionClient) getByNameHandleResponse(resp *htt // GetPrivateLinkResource - Gets the private link resources // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - privateLinkSubResourceName - Name of the private link resource. // - options - PrivateEndpointConnectionClientGetPrivateLinkResourceOptions contains the optional parameters for the PrivateEndpointConnectionClient.GetPrivateLinkResource @@ -296,7 +295,7 @@ func (client *PrivateEndpointConnectionClient) getPrivateLinkResourceCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -313,8 +312,8 @@ func (client *PrivateEndpointConnectionClient) getPrivateLinkResourceHandleRespo // NewListByServicePager - Lists all private endpoint connections of the API Management service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - PrivateEndpointConnectionClientListByServiceOptions contains the optional parameters for the PrivateEndpointConnectionClient.NewListByServicePager // method. @@ -360,7 +359,7 @@ func (client *PrivateEndpointConnectionClient) listByServiceCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -378,8 +377,8 @@ func (client *PrivateEndpointConnectionClient) listByServiceHandleResponse(resp // ListPrivateLinkResources - Gets the private link resources // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - PrivateEndpointConnectionClientListPrivateLinkResourcesOptions contains the optional parameters for the PrivateEndpointConnectionClient.ListPrivateLinkResources // method. @@ -418,7 +417,7 @@ func (client *PrivateEndpointConnectionClient) listPrivateLinkResourcesCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/privateendpointconnection_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/privateendpointconnection_client_example_test.go deleted file mode 100644 index 6867a03dd316..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/privateendpointconnection_client_example_test.go +++ /dev/null @@ -1,250 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPrivateEndpointConnections.json -func ExamplePrivateEndpointConnectionClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionClient().NewListByServicePager("rg1", "apimService1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionListResult = armapimanagement.PrivateEndpointConnectionListResult{ - // Value: []*armapimanagement.PrivateEndpointConnection{ - // { - // Name: to.Ptr("privateEndpointProxyName"), - // Type: to.Ptr("Microsoft.ApiManagement/service/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/connectionName"), - // Properties: &armapimanagement.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armapimanagement.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/privateEndpointName"), - // }, - // PrivateLinkServiceConnectionState: &armapimanagement.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my request, thanks"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armapimanagement.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armapimanagement.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("privateEndpointProxyName2"), - // Type: to.Ptr("Microsoft.ApiManagement/service/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/privateEndpointProxyName2"), - // Properties: &armapimanagement.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armapimanagement.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/privateEndpointName2"), - // }, - // PrivateLinkServiceConnectionState: &armapimanagement.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my request, thanks"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armapimanagement.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armapimanagement.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionClient_GetByName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionClient().GetByName(ctx, "rg1", "apimService1", "privateEndpointConnectionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armapimanagement.PrivateEndpointConnection{ - // Name: to.Ptr("privateEndpointProxyName"), - // Type: to.Ptr("Microsoft.ApiManagement/service/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/privateEndpointConnectionName"), - // Properties: &armapimanagement.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armapimanagement.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/privateEndpointName"), - // }, - // PrivateLinkServiceConnectionState: &armapimanagement.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my request, thanks"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armapimanagement.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armapimanagement.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementApproveOrRejectPrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "privateEndpointConnectionName", armapimanagement.PrivateEndpointConnectionRequest{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/connectionName"), - Properties: &armapimanagement.PrivateEndpointConnectionRequestProperties{ - PrivateLinkServiceConnectionState: &armapimanagement.PrivateLinkServiceConnectionState{ - Description: to.Ptr("The Private Endpoint Connection is approved."), - Status: to.Ptr(armapimanagement.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armapimanagement.PrivateEndpointConnection{ - // Name: to.Ptr("privateEndpointConnectionName"), - // Type: to.Ptr("Microsoft.ApiManagement/service/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/privateEndpointConnectionName"), - // Properties: &armapimanagement.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armapimanagement.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/privateEndpointName"), - // }, - // PrivateLinkServiceConnectionState: &armapimanagement.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("The request has been approved."), - // Status: to.Ptr(armapimanagement.PrivateEndpointServiceConnectionStatus("Succeeded")), - // }, - // ProvisioningState: to.Ptr(armapimanagement.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeletePrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionClient().BeginDelete(ctx, "rg1", "apimService1", "privateEndpointConnectionName", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPrivateLinkGroupResources.json -func ExamplePrivateEndpointConnectionClient_ListPrivateLinkResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionClient().ListPrivateLinkResources(ctx, "rg1", "apimService1", 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.PrivateLinkResourceListResult = armapimanagement.PrivateLinkResourceListResult{ - // Value: []*armapimanagement.PrivateLinkResource{ - // { - // Name: to.Ptr("Gateway"), - // Type: to.Ptr("Microsoft.ApiManagement/service/privateLinkResources"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateLinkResources/Gateway"), - // Properties: &armapimanagement.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("Gateway"), - // RequiredMembers: []*string{ - // to.Ptr("Gateway")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privateLink.azure-api.net")}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPrivateLinkGroupResource.json -func ExamplePrivateEndpointConnectionClient_GetPrivateLinkResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionClient().GetPrivateLinkResource(ctx, "rg1", "apimService1", "privateLinkSubResourceName", 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.PrivateLinkResource = armapimanagement.PrivateLinkResource{ - // Name: to.Ptr("Gateway"), - // Type: to.Ptr("Microsoft.ApiManagement/service/privateLinkResources"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateLinkResources/Gateway"), - // Properties: &armapimanagement.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("Gateway"), - // RequiredMembers: []*string{ - // to.Ptr("Gateway")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privateLink.azure-api.net")}, - // }, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/product_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/product_client.go index c5b0c829a973..115c393b87a2 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/product_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/product_client.go @@ -30,8 +30,7 @@ type ProductClient struct { } // NewProductClient creates a new instance of ProductClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewProductClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductClient, error) { @@ -49,8 +48,8 @@ func NewProductClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Creates or Updates a product. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - parameters - Create or update parameters. @@ -94,7 +93,7 @@ func (client *ProductClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -118,8 +117,8 @@ func (client *ProductClient) createOrUpdateHandleResponse(resp *http.Response) ( // Delete - Delete product. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -167,7 +166,7 @@ func (client *ProductClient) deleteCreateRequest(ctx context.Context, resourceGr if options != nil && options.DeleteSubscriptions != nil { reqQP.Set("deleteSubscriptions", strconv.FormatBool(*options.DeleteSubscriptions)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -177,8 +176,8 @@ func (client *ProductClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Gets the details of the product specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - options - ProductClientGetOptions contains the optional parameters for the ProductClient.Get method. @@ -221,7 +220,7 @@ func (client *ProductClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -241,8 +240,8 @@ func (client *ProductClient) getHandleResponse(resp *http.Response) (ProductClie // GetEntityTag - Gets the entity state (Etag) version of the product specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - options - ProductClientGetEntityTagOptions contains the optional parameters for the ProductClient.GetEntityTag method. @@ -285,7 +284,7 @@ func (client *ProductClient) getEntityTagCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -303,8 +302,8 @@ func (client *ProductClient) getEntityTagHandleResponse(resp *http.Response) (Pr // NewListByServicePager - Lists a collection of products in the specified service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - ProductClientListByServiceOptions contains the optional parameters for the ProductClient.NewListByServicePager // method. @@ -371,7 +370,7 @@ func (client *ProductClient) listByServiceCreateRequest(ctx context.Context, res if options != nil && options.Tags != nil { reqQP.Set("tags", *options.Tags) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -388,8 +387,8 @@ func (client *ProductClient) listByServiceHandleResponse(resp *http.Response) (P // NewListByTagsPager - Lists a collection of products associated with tags. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - ProductClientListByTagsOptions contains the optional parameters for the ProductClient.NewListByTagsPager method. func (client *ProductClient) NewListByTagsPager(resourceGroupName string, serviceName string, options *ProductClientListByTagsOptions) *runtime.Pager[ProductClientListByTagsResponse] { @@ -452,7 +451,7 @@ func (client *ProductClient) listByTagsCreateRequest(ctx context.Context, resour if options != nil && options.IncludeNotTaggedProducts != nil { reqQP.Set("includeNotTaggedProducts", strconv.FormatBool(*options.IncludeNotTaggedProducts)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -470,8 +469,8 @@ func (client *ProductClient) listByTagsHandleResponse(resp *http.Response) (Prod // Update - Update existing product details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -517,7 +516,7 @@ func (client *ProductClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/product_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/product_client_example_test.go deleted file mode 100644 index 23852fa30632..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/product_client_example_test.go +++ /dev/null @@ -1,279 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProducts.json -func ExampleProductClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProductClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.ProductClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: nil, - ExpandGroups: nil, - Tags: 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.ProductCollection = armapimanagement.ProductCollection{ - // Count: to.Ptr[int64](3), - // Value: []*armapimanagement.ProductContract{ - // { - // Name: to.Ptr("kjoshiarmtemplateCert1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/kjoshiarmtemplateCert1"), - // Properties: &armapimanagement.ProductContractProperties{ - // Description: to.Ptr("Development Product"), - // State: to.Ptr(armapimanagement.ProductStatePublished), - // SubscriptionRequired: to.Ptr(false), - // DisplayName: to.Ptr("Dev"), - // }, - // }, - // { - // Name: to.Ptr("starter"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/starter"), - // Properties: &armapimanagement.ProductContractProperties{ - // Description: to.Ptr("Subscribers will be able to run 5 calls/minute up to a maximum of 100 calls/week."), - // ApprovalRequired: to.Ptr(false), - // State: to.Ptr(armapimanagement.ProductStatePublished), - // SubscriptionRequired: to.Ptr(true), - // SubscriptionsLimit: to.Ptr[int32](1), - // Terms: to.Ptr(""), - // DisplayName: to.Ptr("Starter"), - // }, - // }, - // { - // Name: to.Ptr("unlimited"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/unlimited"), - // Properties: &armapimanagement.ProductContractProperties{ - // Description: to.Ptr("Subscribers have completely unlimited access to the API. Administrator approval is required."), - // ApprovalRequired: to.Ptr(true), - // State: to.Ptr(armapimanagement.ProductStatePublished), - // SubscriptionRequired: to.Ptr(true), - // SubscriptionsLimit: to.Ptr[int32](1), - // DisplayName: to.Ptr("Unlimited"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProduct.json -func ExampleProductClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProductClient().GetEntityTag(ctx, "rg1", "apimService1", "unlimited", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProduct.json -func ExampleProductClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductClient().Get(ctx, "rg1", "apimService1", "unlimited", 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.ProductContract = armapimanagement.ProductContract{ - // Name: to.Ptr("unlimited"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/unlimited"), - // Properties: &armapimanagement.ProductContractProperties{ - // Description: to.Ptr("Subscribers have completely unlimited access to the API. Administrator approval is required."), - // ApprovalRequired: to.Ptr(true), - // State: to.Ptr(armapimanagement.ProductStatePublished), - // SubscriptionRequired: to.Ptr(true), - // SubscriptionsLimit: to.Ptr[int32](1), - // DisplayName: to.Ptr("Unlimited"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProduct.json -func ExampleProductClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductClient().CreateOrUpdate(ctx, "rg1", "apimService1", "testproduct", armapimanagement.ProductContract{ - Properties: &armapimanagement.ProductContractProperties{ - DisplayName: to.Ptr("Test Template ProductName 4"), - }, - }, &armapimanagement.ProductClientCreateOrUpdateOptions{IfMatch: 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.ProductContract = armapimanagement.ProductContract{ - // Name: to.Ptr("testproduct"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/testproduct"), - // Properties: &armapimanagement.ProductContractProperties{ - // ApprovalRequired: to.Ptr(false), - // State: to.Ptr(armapimanagement.ProductStateNotPublished), - // SubscriptionRequired: to.Ptr(true), - // DisplayName: to.Ptr("Test Template ProductName 4"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateProduct.json -func ExampleProductClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductClient().Update(ctx, "rg1", "apimService1", "testproduct", "*", armapimanagement.ProductUpdateParameters{ - Properties: &armapimanagement.ProductUpdateProperties{ - DisplayName: to.Ptr("Test Template ProductName 4"), - }, - }, 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.ProductContract = armapimanagement.ProductContract{ - // Name: to.Ptr("testproduct"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/testproduct"), - // Properties: &armapimanagement.ProductContractProperties{ - // Description: to.Ptr("Subscribers have completely unlimited access to the API. Administrator approval is required."), - // ApprovalRequired: to.Ptr(true), - // State: to.Ptr(armapimanagement.ProductStatePublished), - // SubscriptionRequired: to.Ptr(true), - // SubscriptionsLimit: to.Ptr[int32](1), - // DisplayName: to.Ptr("Test Template ProductName 4"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProduct.json -func ExampleProductClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProductClient().Delete(ctx, "rg1", "apimService1", "testproduct", "*", &armapimanagement.ProductClientDeleteOptions{DeleteSubscriptions: to.Ptr(true)}) - 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductsByTags.json -func ExampleProductClient_NewListByTagsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProductClient().NewListByTagsPager("rg1", "apimService1", &armapimanagement.ProductClientListByTagsOptions{Filter: nil, - Top: nil, - Skip: nil, - IncludeNotTaggedProducts: 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.TagResourceCollection = armapimanagement.TagResourceCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.TagResourceContract{ - // { - // Product: &armapimanagement.ProductTagResourceContractProperties{ - // Description: to.Ptr("Subscribers will be able to run 5 calls/minute up to a maximum of 100 calls/week."), - // ApprovalRequired: to.Ptr(false), - // State: to.Ptr(armapimanagement.ProductStatePublished), - // SubscriptionRequired: to.Ptr(true), - // SubscriptionsLimit: to.Ptr[int32](1), - // Terms: to.Ptr(""), - // Name: to.Ptr("Starter"), - // ID: to.Ptr("/products/starter"), - // }, - // Tag: &armapimanagement.TagResourceContractProperties{ - // Name: to.Ptr("awesomeTag"), - // ID: to.Ptr("/tags/apitag123"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/productapi_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/productapi_client.go index 58331db5418f..adf00b2a7d35 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/productapi_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/productapi_client.go @@ -30,8 +30,7 @@ type ProductAPIClient struct { } // NewProductAPIClient creates a new instance of ProductAPIClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewProductAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductAPIClient, error) { @@ -48,8 +47,8 @@ func NewProductAPIClient(subscriptionID string, credential azcore.TokenCredentia // CheckEntityExists - Checks that API entity specified by identifier is associated with the Product entity. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has @@ -99,7 +98,7 @@ func (client *ProductAPIClient) checkEntityExistsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,8 +107,8 @@ func (client *ProductAPIClient) checkEntityExistsCreateRequest(ctx context.Conte // CreateOrUpdate - Adds an API to the specified product. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has @@ -159,7 +158,7 @@ func (client *ProductAPIClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -177,8 +176,8 @@ func (client *ProductAPIClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Deletes the specified API from the specified product. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has @@ -227,7 +226,7 @@ func (client *ProductAPIClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -235,8 +234,8 @@ func (client *ProductAPIClient) deleteCreateRequest(ctx context.Context, resourc // NewListByProductPager - Lists a collection of the APIs associated with a product. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - options - ProductAPIClientListByProductOptions contains the optional parameters for the ProductAPIClient.NewListByProductPager @@ -302,7 +301,7 @@ func (client *ProductAPIClient) listByProductCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/productapi_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/productapi_client_example_test.go deleted file mode 100644 index 7771a8aa5143..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/productapi_client_example_test.go +++ /dev/null @@ -1,138 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductApis.json -func ExampleProductAPIClient_NewListByProductPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProductAPIClient().NewListByProductPager("rg1", "apimService1", "5768181ea40f7eb6c49f6ac7", &armapimanagement.ProductAPIClientListByProductOptions{Filter: nil, - Top: nil, - Skip: 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.APICollection = armapimanagement.APICollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.APIContract{ - // { - // Name: to.Ptr("57681820a40f7eb6c49f6aca"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5768181ea40f7eb6c49f6ac7/apis/57681820a40f7eb6c49f6aca"), - // Properties: &armapimanagement.APIContractProperties{ - // Description: to.Ptr("description_57681820a40f7eb6c49f6acc"), - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // Path: to.Ptr("suffix_57681820a40f7eb6c49f6ace"), - // DisplayName: to.Ptr("api_57681820a40f7eb6c49f6acb"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("http://contoso/57681820a40f7eb6c49f6acd"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProductApi.json -func ExampleProductAPIClient_CheckEntityExists() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProductAPIClient().CheckEntityExists(ctx, "rg1", "apimService1", "5931a75ae4bbd512a88c680b", "59306a29e4bbd510dc24e5f9", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProductApi.json -func ExampleProductAPIClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductAPIClient().CreateOrUpdate(ctx, "rg1", "apimService1", "testproduct", "echo-api", 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.APIContract = armapimanagement.APIContract{ - // Name: to.Ptr("5931a75ae4bbd512a88c680b"), - // Type: to.Ptr("Microsoft.ApiManagement/service/apis"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/5931a75ae4bbd512a88c680b"), - // Properties: &armapimanagement.APIContractProperties{ - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{ - // Header: to.Ptr("Ocp-Apim-Subscription-Key"), - // Query: to.Ptr("subscription-key"), - // }, - // Path: to.Ptr(""), - // DisplayName: to.Ptr("EchoApi"), - // Protocols: []*armapimanagement.Protocol{ - // to.Ptr(armapimanagement.ProtocolHTTP), - // to.Ptr(armapimanagement.ProtocolHTTPS)}, - // ServiceURL: to.Ptr("https://contoso.com/apis/echo"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProductApi.json -func ExampleProductAPIClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProductAPIClient().Delete(ctx, "rg1", "apimService1", "testproduct", "echo-api", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/productapilink_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/productapilink_client.go new file mode 100644 index 000000000000..190c7c3aa2c8 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/productapilink_client.go @@ -0,0 +1,327 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ProductAPILinkClient contains the methods for the ProductAPILink group. +// Don't use this type directly, use NewProductAPILinkClient() instead. +type ProductAPILinkClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProductAPILinkClient creates a new instance of ProductAPILinkClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProductAPILinkClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductAPILinkClient, error) { + cl, err := arm.NewClient(moduleName+".ProductAPILinkClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProductAPILinkClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Adds an API to the specified product via link. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - apiLinkID - Product-API link identifier. Must be unique in the current API Management service instance. +// - parameters - Create or update parameters. +// - options - ProductAPILinkClientCreateOrUpdateOptions contains the optional parameters for the ProductAPILinkClient.CreateOrUpdate +// method. +func (client *ProductAPILinkClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiLinkID string, parameters ProductAPILinkContract, options *ProductAPILinkClientCreateOrUpdateOptions) (ProductAPILinkClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, productID, apiLinkID, parameters, options) + if err != nil { + return ProductAPILinkClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductAPILinkClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ProductAPILinkClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ProductAPILinkClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiLinkID string, parameters ProductAPILinkContract, options *ProductAPILinkClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if apiLinkID == "" { + return nil, errors.New("parameter apiLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiLinkId}", url.PathEscape(apiLinkID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ProductAPILinkClient) createOrUpdateHandleResponse(resp *http.Response) (ProductAPILinkClientCreateOrUpdateResponse, error) { + result := ProductAPILinkClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductAPILinkContract); err != nil { + return ProductAPILinkClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified API from the specified product. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - apiLinkID - Product-API link identifier. Must be unique in the current API Management service instance. +// - options - ProductAPILinkClientDeleteOptions contains the optional parameters for the ProductAPILinkClient.Delete method. +func (client *ProductAPILinkClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiLinkID string, options *ProductAPILinkClientDeleteOptions) (ProductAPILinkClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, productID, apiLinkID, options) + if err != nil { + return ProductAPILinkClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductAPILinkClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ProductAPILinkClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ProductAPILinkClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ProductAPILinkClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiLinkID string, options *ProductAPILinkClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if apiLinkID == "" { + return nil, errors.New("parameter apiLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiLinkId}", url.PathEscape(apiLinkID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the API link for the product. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - apiLinkID - Product-API link identifier. Must be unique in the current API Management service instance. +// - options - ProductAPILinkClientGetOptions contains the optional parameters for the ProductAPILinkClient.Get method. +func (client *ProductAPILinkClient) Get(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiLinkID string, options *ProductAPILinkClientGetOptions) (ProductAPILinkClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, productID, apiLinkID, options) + if err != nil { + return ProductAPILinkClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductAPILinkClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProductAPILinkClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ProductAPILinkClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiLinkID string, options *ProductAPILinkClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if apiLinkID == "" { + return nil, errors.New("parameter apiLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiLinkId}", url.PathEscape(apiLinkID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProductAPILinkClient) getHandleResponse(resp *http.Response) (ProductAPILinkClientGetResponse, error) { + result := ProductAPILinkClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ProductAPILinkContract); err != nil { + return ProductAPILinkClientGetResponse{}, err + } + return result, nil +} + +// NewListByProductPager - Lists a collection of the API links associated with a product. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - options - ProductAPILinkClientListByProductOptions contains the optional parameters for the ProductAPILinkClient.NewListByProductPager +// method. +func (client *ProductAPILinkClient) NewListByProductPager(resourceGroupName string, serviceName string, productID string, options *ProductAPILinkClientListByProductOptions) *runtime.Pager[ProductAPILinkClientListByProductResponse] { + return runtime.NewPager(runtime.PagingHandler[ProductAPILinkClientListByProductResponse]{ + More: func(page ProductAPILinkClientListByProductResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProductAPILinkClientListByProductResponse) (ProductAPILinkClientListByProductResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByProductCreateRequest(ctx, resourceGroupName, serviceName, productID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProductAPILinkClientListByProductResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductAPILinkClientListByProductResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProductAPILinkClientListByProductResponse{}, runtime.NewResponseError(resp) + } + return client.listByProductHandleResponse(resp) + }, + }) +} + +// listByProductCreateRequest creates the ListByProduct request. +func (client *ProductAPILinkClient) listByProductCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, productID string, options *ProductAPILinkClientListByProductOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProductHandleResponse handles the ListByProduct response. +func (client *ProductAPILinkClient) listByProductHandleResponse(resp *http.Response) (ProductAPILinkClientListByProductResponse, error) { + result := ProductAPILinkClientListByProductResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductAPILinkCollection); err != nil { + return ProductAPILinkClientListByProductResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/productgroup_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/productgroup_client.go index 7f4661af899d..3935df3f6356 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/productgroup_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/productgroup_client.go @@ -30,8 +30,7 @@ type ProductGroupClient struct { } // NewProductGroupClient creates a new instance of ProductGroupClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewProductGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductGroupClient, error) { @@ -48,8 +47,8 @@ func NewProductGroupClient(subscriptionID string, credential azcore.TokenCredent // CheckEntityExists - Checks that Group entity specified by identifier is associated with the Product entity. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - groupID - Group identifier. Must be unique in the current API Management service instance. @@ -98,7 +97,7 @@ func (client *ProductGroupClient) checkEntityExistsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -107,8 +106,8 @@ func (client *ProductGroupClient) checkEntityExistsCreateRequest(ctx context.Con // CreateOrUpdate - Adds the association between the specified developer group with the specified product. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - groupID - Group identifier. Must be unique in the current API Management service instance. @@ -157,7 +156,7 @@ func (client *ProductGroupClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -175,8 +174,8 @@ func (client *ProductGroupClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Deletes the association between the specified group and product. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - groupID - Group identifier. Must be unique in the current API Management service instance. @@ -224,7 +223,7 @@ func (client *ProductGroupClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -232,8 +231,8 @@ func (client *ProductGroupClient) deleteCreateRequest(ctx context.Context, resou // NewListByProductPager - Lists the collection of developer groups associated with the specified product. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - options - ProductGroupClientListByProductOptions contains the optional parameters for the ProductGroupClient.NewListByProductPager @@ -299,7 +298,7 @@ func (client *ProductGroupClient) listByProductCreateRequest(ctx context.Context if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/productgroup_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/productgroup_client_example_test.go deleted file mode 100644 index 55e19ec6b89f..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/productgroup_client_example_test.go +++ /dev/null @@ -1,148 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductGroups.json -func ExampleProductGroupClient_NewListByProductPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProductGroupClient().NewListByProductPager("rg1", "apimService1", "5600b57e7e8880006a060002", &armapimanagement.ProductGroupClientListByProductOptions{Filter: nil, - Top: nil, - Skip: 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.GroupCollection = armapimanagement.GroupCollection{ - // Count: to.Ptr[int64](3), - // Value: []*armapimanagement.GroupContract{ - // { - // Name: to.Ptr("5600b57e7e8880006a020001"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products/groups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b57e7e8880006a060002/groups/5600b57e7e8880006a020001"), - // Properties: &armapimanagement.GroupContractProperties{ - // Type: to.Ptr(armapimanagement.GroupTypeSystem), - // Description: to.Ptr("Administrators is a built-in group. Its membership is managed by the system. Microsoft Azure subscription administrators fall into this group."), - // BuiltIn: to.Ptr(true), - // DisplayName: to.Ptr("Administrators"), - // }, - // }, - // { - // Name: to.Ptr("5600b57e7e8880006a020002"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products/groups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b57e7e8880006a060002/groups/5600b57e7e8880006a020002"), - // Properties: &armapimanagement.GroupContractProperties{ - // Type: to.Ptr(armapimanagement.GroupTypeSystem), - // Description: to.Ptr("Developers is a built-in group. Its membership is managed by the system. Signed-in users fall into this group."), - // BuiltIn: to.Ptr(true), - // DisplayName: to.Ptr("Developers"), - // }, - // }, - // { - // Name: to.Ptr("5600b57e7e8880006a020003"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products/groups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b57e7e8880006a060002/groups/5600b57e7e8880006a020003"), - // Properties: &armapimanagement.GroupContractProperties{ - // Type: to.Ptr(armapimanagement.GroupTypeSystem), - // Description: to.Ptr("Guests is a built-in group. Its membership is managed by the system. Unauthenticated users visiting the developer portal fall into this group."), - // BuiltIn: to.Ptr(true), - // DisplayName: to.Ptr("Guests"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProductGroup.json -func ExampleProductGroupClient_CheckEntityExists() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProductGroupClient().CheckEntityExists(ctx, "rg1", "apimService1", "5931a75ae4bbd512a88c680b", "59306a29e4bbd510dc24e5f9", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProductGroup.json -func ExampleProductGroupClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductGroupClient().CreateOrUpdate(ctx, "rg1", "apimService1", "testproduct", "templateGroup", 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.GroupContract = armapimanagement.GroupContract{ - // Name: to.Ptr("templateGroup"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products/groups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/templateGroup"), - // Properties: &armapimanagement.GroupContractProperties{ - // Type: to.Ptr(armapimanagement.GroupTypeCustom), - // Description: to.Ptr("group created via Template"), - // BuiltIn: to.Ptr(false), - // DisplayName: to.Ptr("Template Group"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProductGroup.json -func ExampleProductGroupClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProductGroupClient().Delete(ctx, "rg1", "apimService1", "testproduct", "templateGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/productgrouplink_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/productgrouplink_client.go new file mode 100644 index 000000000000..c4a88fdcb858 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/productgrouplink_client.go @@ -0,0 +1,327 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ProductGroupLinkClient contains the methods for the ProductGroupLink group. +// Don't use this type directly, use NewProductGroupLinkClient() instead. +type ProductGroupLinkClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProductGroupLinkClient creates a new instance of ProductGroupLinkClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProductGroupLinkClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductGroupLinkClient, error) { + cl, err := arm.NewClient(moduleName+".ProductGroupLinkClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProductGroupLinkClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Adds a group to the specified product via link. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - groupLinkID - Product-Group link identifier. Must be unique in the current API Management service instance. +// - parameters - Create or update parameters. +// - options - ProductGroupLinkClientCreateOrUpdateOptions contains the optional parameters for the ProductGroupLinkClient.CreateOrUpdate +// method. +func (client *ProductGroupLinkClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupLinkID string, parameters ProductGroupLinkContract, options *ProductGroupLinkClientCreateOrUpdateOptions) (ProductGroupLinkClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, productID, groupLinkID, parameters, options) + if err != nil { + return ProductGroupLinkClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductGroupLinkClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ProductGroupLinkClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ProductGroupLinkClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupLinkID string, parameters ProductGroupLinkContract, options *ProductGroupLinkClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if groupLinkID == "" { + return nil, errors.New("parameter groupLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupLinkId}", url.PathEscape(groupLinkID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ProductGroupLinkClient) createOrUpdateHandleResponse(resp *http.Response) (ProductGroupLinkClientCreateOrUpdateResponse, error) { + result := ProductGroupLinkClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductGroupLinkContract); err != nil { + return ProductGroupLinkClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified group from the specified product. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - groupLinkID - Product-Group link identifier. Must be unique in the current API Management service instance. +// - options - ProductGroupLinkClientDeleteOptions contains the optional parameters for the ProductGroupLinkClient.Delete method. +func (client *ProductGroupLinkClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupLinkID string, options *ProductGroupLinkClientDeleteOptions) (ProductGroupLinkClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, productID, groupLinkID, options) + if err != nil { + return ProductGroupLinkClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductGroupLinkClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ProductGroupLinkClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ProductGroupLinkClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ProductGroupLinkClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupLinkID string, options *ProductGroupLinkClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if groupLinkID == "" { + return nil, errors.New("parameter groupLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupLinkId}", url.PathEscape(groupLinkID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the group link for the product. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - groupLinkID - Product-Group link identifier. Must be unique in the current API Management service instance. +// - options - ProductGroupLinkClientGetOptions contains the optional parameters for the ProductGroupLinkClient.Get method. +func (client *ProductGroupLinkClient) Get(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupLinkID string, options *ProductGroupLinkClientGetOptions) (ProductGroupLinkClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, productID, groupLinkID, options) + if err != nil { + return ProductGroupLinkClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductGroupLinkClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProductGroupLinkClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ProductGroupLinkClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupLinkID string, options *ProductGroupLinkClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if groupLinkID == "" { + return nil, errors.New("parameter groupLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupLinkId}", url.PathEscape(groupLinkID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProductGroupLinkClient) getHandleResponse(resp *http.Response) (ProductGroupLinkClientGetResponse, error) { + result := ProductGroupLinkClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ProductGroupLinkContract); err != nil { + return ProductGroupLinkClientGetResponse{}, err + } + return result, nil +} + +// NewListByProductPager - Lists a collection of the group links associated with a product. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - options - ProductGroupLinkClientListByProductOptions contains the optional parameters for the ProductGroupLinkClient.NewListByProductPager +// method. +func (client *ProductGroupLinkClient) NewListByProductPager(resourceGroupName string, serviceName string, productID string, options *ProductGroupLinkClientListByProductOptions) *runtime.Pager[ProductGroupLinkClientListByProductResponse] { + return runtime.NewPager(runtime.PagingHandler[ProductGroupLinkClientListByProductResponse]{ + More: func(page ProductGroupLinkClientListByProductResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProductGroupLinkClientListByProductResponse) (ProductGroupLinkClientListByProductResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByProductCreateRequest(ctx, resourceGroupName, serviceName, productID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProductGroupLinkClientListByProductResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductGroupLinkClientListByProductResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProductGroupLinkClientListByProductResponse{}, runtime.NewResponseError(resp) + } + return client.listByProductHandleResponse(resp) + }, + }) +} + +// listByProductCreateRequest creates the ListByProduct request. +func (client *ProductGroupLinkClient) listByProductCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, productID string, options *ProductGroupLinkClientListByProductOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProductHandleResponse handles the ListByProduct response. +func (client *ProductGroupLinkClient) listByProductHandleResponse(resp *http.Response) (ProductGroupLinkClientListByProductResponse, error) { + result := ProductGroupLinkClientListByProductResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductGroupLinkCollection); err != nil { + return ProductGroupLinkClientListByProductResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/productpolicy_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/productpolicy_client.go index 40396eb6c4ac..773e2d9b06c8 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/productpolicy_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/productpolicy_client.go @@ -29,8 +29,7 @@ type ProductPolicyClient struct { } // NewProductPolicyClient creates a new instance of ProductPolicyClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewProductPolicyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductPolicyClient, error) { @@ -48,8 +47,8 @@ func NewProductPolicyClient(subscriptionID string, credential azcore.TokenCreden // CreateOrUpdate - Creates or updates policy configuration for the Product. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - policyID - The identifier of the Policy. @@ -99,7 +98,7 @@ func (client *ProductPolicyClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -123,8 +122,8 @@ func (client *ProductPolicyClient) createOrUpdateHandleResponse(resp *http.Respo // Delete - Deletes the policy configuration at the Product. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - policyID - The identifier of the Policy. @@ -174,7 +173,7 @@ func (client *ProductPolicyClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -184,8 +183,8 @@ func (client *ProductPolicyClient) deleteCreateRequest(ctx context.Context, reso // Get - Get the policy configuration at the Product level. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - policyID - The identifier of the Policy. @@ -236,7 +235,7 @@ func (client *ProductPolicyClient) getCreateRequest(ctx context.Context, resourc if options != nil && options.Format != nil { reqQP.Set("format", string(*options.Format)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -256,8 +255,8 @@ func (client *ProductPolicyClient) getHandleResponse(resp *http.Response) (Produ // GetEntityTag - Get the ETag of the policy configuration at the Product level. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - policyID - The identifier of the Policy. @@ -306,7 +305,7 @@ func (client *ProductPolicyClient) getEntityTagCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,28 +321,40 @@ func (client *ProductPolicyClient) getEntityTagHandleResponse(resp *http.Respons return result, nil } -// ListByProduct - Get the policy configuration at the Product level. -// If the operation fails it returns an *azcore.ResponseError type. +// NewListByProductPager - Get the policy configuration at the Product level. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. -// - options - ProductPolicyClientListByProductOptions contains the optional parameters for the ProductPolicyClient.ListByProduct +// - options - ProductPolicyClientListByProductOptions contains the optional parameters for the ProductPolicyClient.NewListByProductPager // method. -func (client *ProductPolicyClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, options *ProductPolicyClientListByProductOptions) (ProductPolicyClientListByProductResponse, error) { - req, err := client.listByProductCreateRequest(ctx, resourceGroupName, serviceName, productID, options) - if err != nil { - return ProductPolicyClientListByProductResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProductPolicyClientListByProductResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProductPolicyClientListByProductResponse{}, runtime.NewResponseError(resp) - } - return client.listByProductHandleResponse(resp) +func (client *ProductPolicyClient) NewListByProductPager(resourceGroupName string, serviceName string, productID string, options *ProductPolicyClientListByProductOptions) *runtime.Pager[ProductPolicyClientListByProductResponse] { + return runtime.NewPager(runtime.PagingHandler[ProductPolicyClientListByProductResponse]{ + More: func(page ProductPolicyClientListByProductResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProductPolicyClientListByProductResponse) (ProductPolicyClientListByProductResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByProductCreateRequest(ctx, resourceGroupName, serviceName, productID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProductPolicyClientListByProductResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductPolicyClientListByProductResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProductPolicyClientListByProductResponse{}, runtime.NewResponseError(resp) + } + return client.listByProductHandleResponse(resp) + }, + }) } // listByProductCreateRequest creates the ListByProduct request. @@ -370,7 +381,7 @@ func (client *ProductPolicyClient) listByProductCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/productpolicy_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/productpolicy_client_example_test.go deleted file mode 100644 index e104a274b437..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/productpolicy_client_example_test.go +++ /dev/null @@ -1,146 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductPolicies.json -func ExampleProductPolicyClient_ListByProduct() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductPolicyClient().ListByProduct(ctx, "rg1", "apimService1", "armTemplateProduct4", 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.PolicyCollection = armapimanagement.PolicyCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.PolicyContract{ - // { - // Name: to.Ptr("policy"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products/policies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/armTemplateProduct4/policies/policy"), - // Properties: &armapimanagement.PolicyContractProperties{ - // Value: to.Ptr("\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProductPolicy.json -func ExampleProductPolicyClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProductPolicyClient().GetEntityTag(ctx, "rg1", "apimService1", "unlimited", armapimanagement.PolicyIDNamePolicy, 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProductPolicy.json -func ExampleProductPolicyClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductPolicyClient().Get(ctx, "rg1", "apimService1", "kjoshiarmTemplateProduct4", armapimanagement.PolicyIDNamePolicy, &armapimanagement.ProductPolicyClientGetOptions{Format: 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.PolicyContract = armapimanagement.PolicyContract{ - // Name: to.Ptr("policy"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products/policies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/kjoshiarmTemplateProduct4/policies/policy"), - // Properties: &armapimanagement.PolicyContractProperties{ - // Value: to.Ptr("\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProductPolicy.json -func ExampleProductPolicyClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductPolicyClient().CreateOrUpdate(ctx, "rg1", "apimService1", "5702e97e5157a50f48dce801", armapimanagement.PolicyIDNamePolicy, armapimanagement.PolicyContract{ - Properties: &armapimanagement.PolicyContractProperties{ - Format: to.Ptr(armapimanagement.PolicyContentFormatXML), - Value: to.Ptr("\r\n \r\n \r\n \r\n @( string.Join(\",\", DateTime.UtcNow, context.Deployment.ServiceName, context.RequestId, context.Request.IpAddress, context.Operation.Name) ) \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"), - }, - }, &armapimanagement.ProductPolicyClientCreateOrUpdateOptions{IfMatch: 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.PolicyContract = armapimanagement.PolicyContract{ - // Name: to.Ptr("policy"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products/policies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5702e97e5157a50f48dce801/policies/policy"), - // Properties: &armapimanagement.PolicyContractProperties{ - // Value: to.Ptr("\r\n \r\n \r\n \r\n @( string.Join(\",\", DateTime.UtcNow, context.Deployment.ServiceName, context.RequestId, context.Request.IpAddress, context.Operation.Name) ) \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProductPolicy.json -func ExampleProductPolicyClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProductPolicyClient().Delete(ctx, "rg1", "apimService1", "testproduct", armapimanagement.PolicyIDNamePolicy, "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/productsubscriptions_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/productsubscriptions_client.go index b90c83351142..8815c0b6ec36 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/productsubscriptions_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/productsubscriptions_client.go @@ -30,8 +30,7 @@ type ProductSubscriptionsClient struct { } // NewProductSubscriptionsClient creates a new instance of ProductSubscriptionsClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewProductSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductSubscriptionsClient, error) { @@ -48,8 +47,8 @@ func NewProductSubscriptionsClient(subscriptionID string, credential azcore.Toke // NewListPager - Lists the collection of subscriptions to the specified product. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - options - ProductSubscriptionsClientListOptions contains the optional parameters for the ProductSubscriptionsClient.NewListPager @@ -115,7 +114,7 @@ func (client *ProductSubscriptionsClient) listCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/productsubscriptions_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/productsubscriptions_client_example_test.go deleted file mode 100644 index 60f59dee2f66..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/productsubscriptions_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductSubscriptions.json -func ExampleProductSubscriptionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProductSubscriptionsClient().NewListPager("rg1", "apimService1", "5600b57e7e8880006a060002", &armapimanagement.ProductSubscriptionsClientListOptions{Filter: nil, - Top: nil, - Skip: 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.SubscriptionCollection = armapimanagement.SubscriptionCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.SubscriptionContract{ - // { - // Name: to.Ptr("5600b57e7e8880006a070002"), - // Type: to.Ptr("Microsoft.ApiManagement/service/products/subscriptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b57e7e8880006a060002/subscriptions/5600b57e7e8880006a070002"), - // Properties: &armapimanagement.SubscriptionContractProperties{ - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-09-22T01:57:18.723Z"); return t}()), - // OwnerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - // Scope: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b57e7e8880006a060002"), - // State: to.Ptr(armapimanagement.SubscriptionStateActive), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/productwiki_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/productwiki_client.go new file mode 100644 index 000000000000..35b05e224e9c --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/productwiki_client.go @@ -0,0 +1,368 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ProductWikiClient contains the methods for the ProductWiki group. +// Don't use this type directly, use NewProductWikiClient() instead. +type ProductWikiClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProductWikiClient creates a new instance of ProductWikiClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProductWikiClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductWikiClient, error) { + cl, err := arm.NewClient(moduleName+".ProductWikiClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProductWikiClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates a new Wiki for a Product or updates an existing one. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - parameters - Create parameters. +// - options - ProductWikiClientCreateOrUpdateOptions contains the optional parameters for the ProductWikiClient.CreateOrUpdate +// method. +func (client *ProductWikiClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters WikiContract, options *ProductWikiClientCreateOrUpdateOptions) (ProductWikiClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, productID, parameters, options) + if err != nil { + return ProductWikiClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductWikiClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ProductWikiClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ProductWikiClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters WikiContract, options *ProductWikiClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ProductWikiClient) createOrUpdateHandleResponse(resp *http.Response) (ProductWikiClientCreateOrUpdateResponse, error) { + result := ProductWikiClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.WikiContract); err != nil { + return ProductWikiClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified Wiki from a Product. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - ProductWikiClientDeleteOptions contains the optional parameters for the ProductWikiClient.Delete method. +func (client *ProductWikiClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string, options *ProductWikiClientDeleteOptions) (ProductWikiClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, productID, ifMatch, options) + if err != nil { + return ProductWikiClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductWikiClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ProductWikiClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ProductWikiClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ProductWikiClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string, options *ProductWikiClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the Wiki for a Product specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - options - ProductWikiClientGetOptions contains the optional parameters for the ProductWikiClient.Get method. +func (client *ProductWikiClient) Get(ctx context.Context, resourceGroupName string, serviceName string, productID string, options *ProductWikiClientGetOptions) (ProductWikiClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, productID, options) + if err != nil { + return ProductWikiClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductWikiClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProductWikiClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ProductWikiClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, productID string, options *ProductWikiClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProductWikiClient) getHandleResponse(resp *http.Response) (ProductWikiClientGetResponse, error) { + result := ProductWikiClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.WikiContract); err != nil { + return ProductWikiClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the Wiki for a Product specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - options - ProductWikiClientGetEntityTagOptions contains the optional parameters for the ProductWikiClient.GetEntityTag +// method. +func (client *ProductWikiClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, productID string, options *ProductWikiClientGetEntityTagOptions) (ProductWikiClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, productID, options) + if err != nil { + return ProductWikiClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductWikiClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProductWikiClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *ProductWikiClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, productID string, options *ProductWikiClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *ProductWikiClient) getEntityTagHandleResponse(resp *http.Response) (ProductWikiClientGetEntityTagResponse, error) { + result := ProductWikiClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// Update - Updates the details of the Wiki for a Product specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - Wiki Update parameters. +// - options - ProductWikiClientUpdateOptions contains the optional parameters for the ProductWikiClient.Update method. +func (client *ProductWikiClient) Update(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string, parameters WikiUpdateContract, options *ProductWikiClientUpdateOptions) (ProductWikiClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, productID, ifMatch, parameters, options) + if err != nil { + return ProductWikiClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductWikiClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProductWikiClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *ProductWikiClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string, parameters WikiUpdateContract, options *ProductWikiClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *ProductWikiClient) updateHandleResponse(resp *http.Response) (ProductWikiClientUpdateResponse, error) { + result := ProductWikiClientUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.WikiContract); err != nil { + return ProductWikiClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/productwikis_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/productwikis_client.go new file mode 100644 index 000000000000..9a7ad1f6b3e5 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/productwikis_client.go @@ -0,0 +1,132 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ProductWikisClient contains the methods for the ProductWikis group. +// Don't use this type directly, use NewProductWikisClient() instead. +type ProductWikisClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProductWikisClient creates a new instance of ProductWikisClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProductWikisClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductWikisClient, error) { + cl, err := arm.NewClient(moduleName+".ProductWikisClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProductWikisClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets the details of the Wiki for a Product specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - options - ProductWikisClientListOptions contains the optional parameters for the ProductWikisClient.NewListPager method. +func (client *ProductWikisClient) NewListPager(resourceGroupName string, serviceName string, productID string, options *ProductWikisClientListOptions) *runtime.Pager[ProductWikisClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ProductWikisClientListResponse]{ + More: func(page ProductWikisClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProductWikisClientListResponse) (ProductWikisClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, serviceName, productID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProductWikisClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductWikisClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProductWikisClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ProductWikisClient) listCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, productID string, options *ProductWikisClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ProductWikisClient) listHandleResponse(resp *http.Response) (ProductWikisClientListResponse, error) { + result := ProductWikisClientListResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.WikiCollection); err != nil { + return ProductWikisClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/quotabycounterkeys_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/quotabycounterkeys_client.go index c20cda83d625..bd0f29812d5f 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/quotabycounterkeys_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/quotabycounterkeys_client.go @@ -29,8 +29,7 @@ type QuotaByCounterKeysClient struct { } // NewQuotaByCounterKeysClient creates a new instance of QuotaByCounterKeysClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewQuotaByCounterKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*QuotaByCounterKeysClient, error) { @@ -49,8 +48,8 @@ func NewQuotaByCounterKeysClient(subscriptionID string, credential azcore.TokenC // on the specified service instance. The api does not support paging yet. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - quotaCounterKey - Quota counter key identifier.This is the result of expression defined in counter-key attribute of the // quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s @@ -96,7 +95,7 @@ func (client *QuotaByCounterKeysClient) listByServiceCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,8 +114,8 @@ func (client *QuotaByCounterKeysClient) listByServiceHandleResponse(resp *http.R // service instance. This should be used for reset of the quota counter values. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - quotaCounterKey - Quota counter key identifier.This is the result of expression defined in counter-key attribute of the // quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s @@ -163,7 +162,7 @@ func (client *QuotaByCounterKeysClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/quotabycounterkeys_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/quotabycounterkeys_client_example_test.go deleted file mode 100644 index 895e4dd8d149..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/quotabycounterkeys_client_example_test.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetQuotaCounterKeys.json -func ExampleQuotaByCounterKeysClient_ListByService() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQuotaByCounterKeysClient().ListByService(ctx, "rg1", "apimService1", "ba", 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.QuotaCounterCollection = armapimanagement.QuotaCounterCollection{ - // Value: []*armapimanagement.QuotaCounterContract{ - // { - // CounterKey: to.Ptr("ba"), - // PeriodEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-08T16:54:40Z"); return t}()), - // PeriodKey: to.Ptr("0_P3Y6M4DT12H30M5S"), - // PeriodStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2014-08-04T04:24:35Z"); return t}()), - // Value: &armapimanagement.QuotaCounterValueContractProperties{ - // CallsCount: to.Ptr[int32](5), - // KbTransferred: to.Ptr[float64](2.5830078125), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateQuotaCounterKey.json -func ExampleQuotaByCounterKeysClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQuotaByCounterKeysClient().Update(ctx, "rg1", "apimService1", "ba", armapimanagement.QuotaCounterValueUpdateContract{ - Properties: &armapimanagement.QuotaCounterValueContractProperties{ - CallsCount: to.Ptr[int32](0), - KbTransferred: to.Ptr[float64](2.5630078125), - }, - }, 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.QuotaCounterCollection = armapimanagement.QuotaCounterCollection{ - // Value: []*armapimanagement.QuotaCounterContract{ - // { - // CounterKey: to.Ptr("ba"), - // PeriodEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-08T16:54:40Z"); return t}()), - // PeriodKey: to.Ptr("0_P3Y6M4DT12H30M5S"), - // PeriodStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2014-08-04T04:24:35Z"); return t}()), - // Value: &armapimanagement.QuotaCounterValueContractProperties{ - // CallsCount: to.Ptr[int32](5), - // KbTransferred: to.Ptr[float64](2.5830078125), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/quotabyperiodkeys_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/quotabyperiodkeys_client.go index 38ebc24c8081..f598efb72b54 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/quotabyperiodkeys_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/quotabyperiodkeys_client.go @@ -29,8 +29,7 @@ type QuotaByPeriodKeysClient struct { } // NewQuotaByPeriodKeysClient creates a new instance of QuotaByPeriodKeysClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewQuotaByPeriodKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*QuotaByPeriodKeysClient, error) { @@ -49,8 +48,8 @@ func NewQuotaByPeriodKeysClient(subscriptionID string, credential azcore.TokenCr // instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - quotaCounterKey - Quota counter key identifier.This is the result of expression defined in counter-key attribute of the // quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s @@ -100,7 +99,7 @@ func (client *QuotaByPeriodKeysClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -118,8 +117,8 @@ func (client *QuotaByPeriodKeysClient) getHandleResponse(resp *http.Response) (Q // Update - Updates an existing quota counter value in the specified service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - quotaCounterKey - Quota counter key identifier.This is the result of expression defined in counter-key attribute of the // quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s @@ -171,7 +170,7 @@ func (client *QuotaByPeriodKeysClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/quotabyperiodkeys_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/quotabyperiodkeys_client_example_test.go deleted file mode 100644 index fb2a34c535ff..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/quotabyperiodkeys_client_example_test.go +++ /dev/null @@ -1,84 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetQuotaCounterKeysByQuotaPeriod.json -func ExampleQuotaByPeriodKeysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQuotaByPeriodKeysClient().Get(ctx, "rg1", "apimService1", "ba", "0_P3Y6M4DT12H30M5S", 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.QuotaCounterContract = armapimanagement.QuotaCounterContract{ - // CounterKey: to.Ptr("ba"), - // PeriodEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-08T16:54:40Z"); return t}()), - // PeriodKey: to.Ptr("0_P3Y6M4DT12H30M5S"), - // PeriodStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2014-08-04T04:24:35Z"); return t}()), - // Value: &armapimanagement.QuotaCounterValueContractProperties{ - // CallsCount: to.Ptr[int32](0), - // KbTransferred: to.Ptr[float64](2.5625), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateQuotaCounterKeyByQuotaPeriod.json -func ExampleQuotaByPeriodKeysClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQuotaByPeriodKeysClient().Update(ctx, "rg1", "apimService1", "ba", "0_P3Y6M4DT12H30M5S", armapimanagement.QuotaCounterValueUpdateContract{ - Properties: &armapimanagement.QuotaCounterValueContractProperties{ - CallsCount: to.Ptr[int32](0), - KbTransferred: to.Ptr[float64](0), - }, - }, 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.QuotaCounterContract = armapimanagement.QuotaCounterContract{ - // CounterKey: to.Ptr("ba"), - // PeriodEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-08T16:54:40Z"); return t}()), - // PeriodKey: to.Ptr("0_P3Y6M4DT12H30M5S"), - // PeriodStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2014-08-04T04:24:35Z"); return t}()), - // Value: &armapimanagement.QuotaCounterValueContractProperties{ - // CallsCount: to.Ptr[int32](0), - // KbTransferred: to.Ptr[float64](2.5625), - // }, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/region_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/region_client.go index 325ff0efa0da..4aae779226a7 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/region_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/region_client.go @@ -29,8 +29,7 @@ type RegionClient struct { } // NewRegionClient creates a new instance of RegionClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewRegionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RegionClient, error) { @@ -47,8 +46,8 @@ func NewRegionClient(subscriptionID string, credential azcore.TokenCredential, o // NewListByServicePager - Lists all azure regions in which the service exists. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - RegionClientListByServiceOptions contains the optional parameters for the RegionClient.NewListByServicePager // method. @@ -100,7 +99,7 @@ func (client *RegionClient) listByServiceCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/region_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/region_client_example_test.go deleted file mode 100644 index 12546e3d0cc7..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/region_client_example_test.go +++ /dev/null @@ -1,52 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListRegions.json -func ExampleRegionClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRegionClient().NewListByServicePager("rg1", "apimService1", 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.RegionListResult = armapimanagement.RegionListResult{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.RegionContract{ - // { - // Name: to.Ptr("West US"), - // IsDeleted: to.Ptr(false), - // IsMasterRegion: to.Ptr(true), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/reports_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/reports_client.go index b5bf31465f36..e828a2494282 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/reports_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/reports_client.go @@ -30,8 +30,7 @@ type ReportsClient struct { } // NewReportsClient creates a new instance of ReportsClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewReportsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReportsClient, error) { @@ -48,8 +47,8 @@ func NewReportsClient(subscriptionID string, credential azcore.TokenCredential, // NewListByAPIPager - Lists report records by API. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - filter - The filter to apply on the operation. // - options - ReportsClientListByAPIOptions contains the optional parameters for the ReportsClient.NewListByAPIPager method. @@ -111,7 +110,7 @@ func (client *ReportsClient) listByAPICreateRequest(ctx context.Context, resourc if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -128,8 +127,8 @@ func (client *ReportsClient) listByAPIHandleResponse(resp *http.Response) (Repor // NewListByGeoPager - Lists report records by geography. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - filter - | Field | Usage | Supported operators | Supported functions | // |-------------|-------------|-------------|-------------| @@ -212,7 +211,7 @@ func (client *ReportsClient) listByGeoCreateRequest(ctx context.Context, resourc if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -229,8 +228,8 @@ func (client *ReportsClient) listByGeoHandleResponse(resp *http.Response) (Repor // NewListByOperationPager - Lists report records by API Operations. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - filter - | Field | Usage | Supported operators | Supported functions | // |-------------|-------------|-------------|-------------| @@ -316,7 +315,7 @@ func (client *ReportsClient) listByOperationCreateRequest(ctx context.Context, r if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -333,8 +332,8 @@ func (client *ReportsClient) listByOperationHandleResponse(resp *http.Response) // NewListByProductPager - Lists report records by Product. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - filter - | Field | Usage | Supported operators | Supported functions | // |-------------|-------------|-------------|-------------| @@ -418,7 +417,7 @@ func (client *ReportsClient) listByProductCreateRequest(ctx context.Context, res if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -435,8 +434,8 @@ func (client *ReportsClient) listByProductHandleResponse(resp *http.Response) (R // NewListByRequestPager - Lists report records by Request. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - filter - | Field | Usage | Supported operators | Supported functions | // |-------------|-------------|-------------|-------------| @@ -498,7 +497,7 @@ func (client *ReportsClient) listByRequestCreateRequest(ctx context.Context, res if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -515,8 +514,8 @@ func (client *ReportsClient) listByRequestHandleResponse(resp *http.Response) (R // NewListBySubscriptionPager - Lists report records by subscription. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - filter - | Field | Usage | Supported operators | Supported functions | // |-------------|-------------|-------------|-------------| @@ -600,7 +599,7 @@ func (client *ReportsClient) listBySubscriptionCreateRequest(ctx context.Context if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -617,8 +616,8 @@ func (client *ReportsClient) listBySubscriptionHandleResponse(resp *http.Respons // NewListByTimePager - Lists report records by Time. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - filter - | Field | Usage | Supported operators | Supported functions | // |-------------|-------------|-------------|-------------| @@ -706,7 +705,7 @@ func (client *ReportsClient) listByTimeCreateRequest(ctx context.Context, resour reqQP.Set("$orderby", *options.Orderby) } reqQP.Set("interval", interval) - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -723,8 +722,8 @@ func (client *ReportsClient) listByTimeHandleResponse(resp *http.Response) (Repo // NewListByUserPager - Lists report records by User. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - filter - | Field | Usage | Supported operators | Supported functions | // |-------------|-------------|-------------|-------------| @@ -809,7 +808,7 @@ func (client *ReportsClient) listByUserCreateRequest(ctx context.Context, resour if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/reports_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/reports_client_example_test.go deleted file mode 100644 index 1cb1d238282a..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/reports_client_example_test.go +++ /dev/null @@ -1,607 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByApi.json -func ExampleReportsClient_NewListByAPIPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReportsClient().NewListByAPIPager("rg1", "apimService1", "timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", &armapimanagement.ReportsClientListByAPIOptions{Top: nil, - Skip: nil, - Orderby: 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.ReportCollection = armapimanagement.ReportCollection{ - // Count: to.Ptr[int64](2), - // Value: []*armapimanagement.ReportRecordContract{ - // { - // Name: to.Ptr("Echo API"), - // APIID: to.Ptr("/apis/5600b59475ff190048040001"), - // APITimeAvg: to.Ptr[float64](0), - // APITimeMax: to.Ptr[float64](0), - // APITimeMin: to.Ptr[float64](0), - // Bandwidth: to.Ptr[int64](0), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](0), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](0), - // CallCountTotal: to.Ptr[int32](0), - // ServiceTimeAvg: to.Ptr[float64](0), - // ServiceTimeMax: to.Ptr[float64](0), - // ServiceTimeMin: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("httpbin"), - // APIID: to.Ptr("/apis/57a03a13e4bbd5119c8b19e9"), - // APITimeAvg: to.Ptr[float64](1015.7607923076923), - // APITimeMax: to.Ptr[float64](1819.2173), - // APITimeMin: to.Ptr[float64](330.3206), - // Bandwidth: to.Ptr[int64](11019), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](1), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](13), - // CallCountTotal: to.Ptr[int32](14), - // ServiceTimeAvg: to.Ptr[float64](957.094776923077), - // ServiceTimeMax: to.Ptr[float64](1697.3612), - // ServiceTimeMin: to.Ptr[float64](215.24), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByUser.json -func ExampleReportsClient_NewListByUserPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReportsClient().NewListByUserPager("rg1", "apimService1", "timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", &armapimanagement.ReportsClientListByUserOptions{Top: nil, - Skip: nil, - Orderby: 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.ReportCollection = armapimanagement.ReportCollection{ - // Count: to.Ptr[int64](3), - // Value: []*armapimanagement.ReportRecordContract{ - // { - // Name: to.Ptr("Administrator"), - // APITimeAvg: to.Ptr[float64](1015.7607923076923), - // APITimeMax: to.Ptr[float64](1819.2173), - // APITimeMin: to.Ptr[float64](330.3206), - // Bandwidth: to.Ptr[int64](11019), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](1), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](13), - // CallCountTotal: to.Ptr[int32](14), - // ServiceTimeAvg: to.Ptr[float64](957.094776923077), - // ServiceTimeMax: to.Ptr[float64](1697.3612), - // ServiceTimeMin: to.Ptr[float64](215.24), - // UserID: to.Ptr("/users/1"), - // }, - // { - // Name: to.Ptr("Samir Solanki"), - // APITimeAvg: to.Ptr[float64](0), - // APITimeMax: to.Ptr[float64](0), - // APITimeMin: to.Ptr[float64](0), - // Bandwidth: to.Ptr[int64](0), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](0), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](0), - // CallCountTotal: to.Ptr[int32](0), - // ServiceTimeAvg: to.Ptr[float64](0), - // ServiceTimeMax: to.Ptr[float64](0), - // ServiceTimeMin: to.Ptr[float64](0), - // UserID: to.Ptr("/users/56eaec62baf08b06e46d27fd"), - // }, - // { - // Name: to.Ptr("Anonymous"), - // APITimeAvg: to.Ptr[float64](0), - // APITimeMax: to.Ptr[float64](0), - // APITimeMin: to.Ptr[float64](0), - // Bandwidth: to.Ptr[int64](0), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](0), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](0), - // CallCountTotal: to.Ptr[int32](0), - // ServiceTimeAvg: to.Ptr[float64](0), - // ServiceTimeMax: to.Ptr[float64](0), - // ServiceTimeMin: to.Ptr[float64](0), - // UserID: to.Ptr("/users/54c800b332965a0035030000"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByOperation.json -func ExampleReportsClient_NewListByOperationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReportsClient().NewListByOperationPager("rg1", "apimService1", "timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", &armapimanagement.ReportsClientListByOperationOptions{Top: nil, - Skip: nil, - Orderby: 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.ReportCollection = armapimanagement.ReportCollection{ - // Count: to.Ptr[int64](3), - // Value: []*armapimanagement.ReportRecordContract{ - // { - // Name: to.Ptr("get"), - // OperationID: to.Ptr("/apis/57a03a13e4bbd5119c8b19e9/operations/57a03a1dd8d14f0a780d7d14"), - // APIID: to.Ptr("/apis/57a03a13e4bbd5119c8b19e9"), - // APITimeAvg: to.Ptr[float64](1015.7607923076923), - // APITimeMax: to.Ptr[float64](1819.2173), - // APITimeMin: to.Ptr[float64](330.3206), - // Bandwidth: to.Ptr[int64](11019), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](1), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](13), - // CallCountTotal: to.Ptr[int32](14), - // ServiceTimeAvg: to.Ptr[float64](957.094776923077), - // ServiceTimeMax: to.Ptr[float64](1697.3612), - // ServiceTimeMin: to.Ptr[float64](215.24), - // }, - // { - // Name: to.Ptr("GetWeatherInformation"), - // OperationID: to.Ptr("/apis/57c999d1e4bbd50c988cb2c3/operations/57c999d1e4bbd50df889c93e"), - // APIID: to.Ptr("/apis/57c999d1e4bbd50c988cb2c3"), - // APITimeAvg: to.Ptr[float64](0), - // APITimeMax: to.Ptr[float64](0), - // APITimeMin: to.Ptr[float64](0), - // Bandwidth: to.Ptr[int64](0), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](0), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](0), - // CallCountTotal: to.Ptr[int32](0), - // ServiceTimeAvg: to.Ptr[float64](0), - // ServiceTimeMax: to.Ptr[float64](0), - // ServiceTimeMin: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("GetCityForecastByZIP"), - // OperationID: to.Ptr("/apis/57c999d1e4bbd50c988cb2c3/operations/57c999d1e4bbd50df889c93f"), - // APIID: to.Ptr("/apis/57c999d1e4bbd50c988cb2c3"), - // APITimeAvg: to.Ptr[float64](0), - // APITimeMax: to.Ptr[float64](0), - // APITimeMin: to.Ptr[float64](0), - // Bandwidth: to.Ptr[int64](0), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](0), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](0), - // CallCountTotal: to.Ptr[int32](0), - // ServiceTimeAvg: to.Ptr[float64](0), - // ServiceTimeMax: to.Ptr[float64](0), - // ServiceTimeMin: to.Ptr[float64](0), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByProduct.json -func ExampleReportsClient_NewListByProductPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReportsClient().NewListByProductPager("rg1", "apimService1", "timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", &armapimanagement.ReportsClientListByProductOptions{Top: nil, - Skip: nil, - Orderby: 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.ReportCollection = armapimanagement.ReportCollection{ - // Count: to.Ptr[int64](2), - // Value: []*armapimanagement.ReportRecordContract{ - // { - // Name: to.Ptr("Starter"), - // APITimeAvg: to.Ptr[float64](0), - // APITimeMax: to.Ptr[float64](0), - // APITimeMin: to.Ptr[float64](0), - // Bandwidth: to.Ptr[int64](0), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](0), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](0), - // CallCountTotal: to.Ptr[int32](0), - // ProductID: to.Ptr("/products/5600b59475ff190048060001"), - // ServiceTimeAvg: to.Ptr[float64](0), - // ServiceTimeMax: to.Ptr[float64](0), - // ServiceTimeMin: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("Unlimited"), - // APITimeAvg: to.Ptr[float64](1015.7607923076923), - // APITimeMax: to.Ptr[float64](1819.2173), - // APITimeMin: to.Ptr[float64](330.3206), - // Bandwidth: to.Ptr[int64](11019), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](1), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](13), - // CallCountTotal: to.Ptr[int32](14), - // ProductID: to.Ptr("/products/5600b59475ff190048060002"), - // ServiceTimeAvg: to.Ptr[float64](957.094776923077), - // ServiceTimeMax: to.Ptr[float64](1697.3612), - // ServiceTimeMin: to.Ptr[float64](215.24), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByGeo.json -func ExampleReportsClient_NewListByGeoPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReportsClient().NewListByGeoPager("rg1", "apimService1", "timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", &armapimanagement.ReportsClientListByGeoOptions{Top: nil, - Skip: 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.ReportCollection = armapimanagement.ReportCollection{ - // Value: []*armapimanagement.ReportRecordContract{ - // { - // APITimeAvg: to.Ptr[float64](1015.7607923076923), - // APITimeMax: to.Ptr[float64](1819.2173), - // APITimeMin: to.Ptr[float64](330.3206), - // Bandwidth: to.Ptr[int64](11019), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](1), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](13), - // CallCountTotal: to.Ptr[int32](14), - // Country: to.Ptr("US"), - // Region: to.Ptr("WA"), - // ServiceTimeAvg: to.Ptr[float64](957.094776923077), - // ServiceTimeMax: to.Ptr[float64](1697.3612), - // ServiceTimeMin: to.Ptr[float64](215.24), - // Zip: to.Ptr("98052"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsBySubscription.json -func ExampleReportsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReportsClient().NewListBySubscriptionPager("rg1", "apimService1", "timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", &armapimanagement.ReportsClientListBySubscriptionOptions{Top: nil, - Skip: nil, - Orderby: 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.ReportCollection = armapimanagement.ReportCollection{ - // Count: to.Ptr[int64](3), - // Value: []*armapimanagement.ReportRecordContract{ - // { - // Name: to.Ptr(""), - // APITimeAvg: to.Ptr[float64](0), - // APITimeMax: to.Ptr[float64](0), - // APITimeMin: to.Ptr[float64](0), - // Bandwidth: to.Ptr[int64](0), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](0), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](0), - // CallCountTotal: to.Ptr[int32](0), - // ProductID: to.Ptr("/products/5600b59475ff190048060001"), - // ServiceTimeAvg: to.Ptr[float64](0), - // ServiceTimeMax: to.Ptr[float64](0), - // ServiceTimeMin: to.Ptr[float64](0), - // SubscriptionID: to.Ptr("/subscriptions/5600b59475ff190048070001"), - // UserID: to.Ptr("/users/1"), - // }, - // { - // Name: to.Ptr(""), - // APITimeAvg: to.Ptr[float64](1015.7607923076923), - // APITimeMax: to.Ptr[float64](1819.2173), - // APITimeMin: to.Ptr[float64](330.3206), - // Bandwidth: to.Ptr[int64](11019), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](1), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](13), - // CallCountTotal: to.Ptr[int32](14), - // ProductID: to.Ptr("/products/5600b59475ff190048060002"), - // ServiceTimeAvg: to.Ptr[float64](957.094776923077), - // ServiceTimeMax: to.Ptr[float64](1697.3612), - // ServiceTimeMin: to.Ptr[float64](215.24), - // SubscriptionID: to.Ptr("/subscriptions/5600b59475ff190048070002"), - // UserID: to.Ptr("/users/1"), - // }, - // { - // Name: to.Ptr(""), - // APITimeAvg: to.Ptr[float64](0), - // APITimeMax: to.Ptr[float64](0), - // APITimeMin: to.Ptr[float64](0), - // Bandwidth: to.Ptr[int64](0), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](0), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](0), - // CallCountTotal: to.Ptr[int32](0), - // ProductID: to.Ptr("/products/5702e97e5157a50f48dce801"), - // ServiceTimeAvg: to.Ptr[float64](0), - // ServiceTimeMax: to.Ptr[float64](0), - // ServiceTimeMin: to.Ptr[float64](0), - // SubscriptionID: to.Ptr("/subscriptions/5702e97e5157a50a9c733303"), - // UserID: to.Ptr("/users/1"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByTime.json -func ExampleReportsClient_NewListByTimePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReportsClient().NewListByTimePager("rg1", "apimService1", "timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", "PT15M", &armapimanagement.ReportsClientListByTimeOptions{Top: nil, - Skip: nil, - Orderby: 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.ReportCollection = armapimanagement.ReportCollection{ - // Count: to.Ptr[int64](2), - // Value: []*armapimanagement.ReportRecordContract{ - // { - // APITimeAvg: to.Ptr[float64](1337.46335), - // APITimeMax: to.Ptr[float64](1819.2173), - // APITimeMin: to.Ptr[float64](885.0839000000001), - // Bandwidth: to.Ptr[int64](3243), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](0), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](4), - // CallCountTotal: to.Ptr[int32](4), - // Interval: to.Ptr("PT15M"), - // ServiceTimeAvg: to.Ptr[float64](1255.917425), - // ServiceTimeMax: to.Ptr[float64](1697.3612), - // ServiceTimeMin: to.Ptr[float64](882.8264), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-03T00:15:00Z"); return t}()), - // }, - // { - // APITimeAvg: to.Ptr[float64](872.7818777777778), - // APITimeMax: to.Ptr[float64](1093.8407), - // APITimeMin: to.Ptr[float64](330.3206), - // Bandwidth: to.Ptr[int64](7776), - // CacheHitCount: to.Ptr[int32](0), - // CacheMissCount: to.Ptr[int32](0), - // CallCountBlocked: to.Ptr[int32](1), - // CallCountFailed: to.Ptr[int32](0), - // CallCountOther: to.Ptr[int32](0), - // CallCountSuccess: to.Ptr[int32](9), - // CallCountTotal: to.Ptr[int32](10), - // Interval: to.Ptr("PT15M"), - // ServiceTimeAvg: to.Ptr[float64](824.2847111111112), - // ServiceTimeMax: to.Ptr[float64](973.2262000000001), - // ServiceTimeMin: to.Ptr[float64](215.24), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-03T00:30:00Z"); return t}()), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByRequest.json -func ExampleReportsClient_NewListByRequestPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReportsClient().NewListByRequestPager("rg1", "apimService1", "timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'", &armapimanagement.ReportsClientListByRequestOptions{Top: nil, - Skip: 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.RequestReportCollection = armapimanagement.RequestReportCollection{ - // Count: to.Ptr[int64](2), - // Value: []*armapimanagement.RequestReportRecordContract{ - // { - // OperationID: to.Ptr("/apis/5931a75ae4bbd512a88c680b/operations/-"), - // Method: to.Ptr("GET"), - // APIID: to.Ptr("/apis/5931a75ae4bbd512a88c680b"), - // APIRegion: to.Ptr("East Asia"), - // APITime: to.Ptr[float64](221.1544), - // Cache: to.Ptr("none"), - // IPAddress: to.Ptr("207.xx.155.xx"), - // ProductID: to.Ptr("/products/-"), - // RequestID: to.Ptr("63e7119c-26aa-433c-96d7-f6f3267ff52f"), - // RequestSize: to.Ptr[int32](0), - // ResponseCode: to.Ptr[int32](404), - // ResponseSize: to.Ptr[int32](405), - // ServiceTime: to.Ptr[float64](0), - // SubscriptionID: to.Ptr("/subscriptions/5600b59475ff190048070002"), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-03T00:17:00.1649134Z"); return t}()), - // URL: to.Ptr("https://apimService1.azure-api.net/echo/resource?param1=sample"), - // UserID: to.Ptr("/users/1"), - // }, - // { - // OperationID: to.Ptr("/apis/5931a75ae4bbd512a88c680b/operations/-"), - // Method: to.Ptr("POST"), - // APIID: to.Ptr("/apis/5931a75ae4bbd512a88c680b"), - // APIRegion: to.Ptr("East Asia"), - // APITime: to.Ptr[float64](6.675400000000001), - // Cache: to.Ptr("none"), - // IPAddress: to.Ptr("207.xx.155.xx"), - // ProductID: to.Ptr("/products/-"), - // RequestID: to.Ptr("e581b7f7-c9ec-4fc6-8ab9-3855d9b00b04"), - // RequestSize: to.Ptr[int32](0), - // ResponseCode: to.Ptr[int32](404), - // ResponseSize: to.Ptr[int32](403), - // ServiceTime: to.Ptr[float64](0), - // SubscriptionID: to.Ptr("/subscriptions/5600b59475ff190048070002"), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-03T00:17:20.5255131Z"); return t}()), - // URL: to.Ptr("https://apimService1.azure-api.net/echo/resource"), - // UserID: to.Ptr("/users/1"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/response_types.go b/sdk/resourcemanager/apimanagement/armapimanagement/response_types.go index 4cd90d97a3b8..b1d7e2f0b0e0 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/response_types.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/response_types.go @@ -463,6 +463,131 @@ type APIVersionSetClientUpdateResponse struct { ETag *string } +// APIWikiClientCreateOrUpdateResponse contains the response from method APIWikiClient.CreateOrUpdate. +type APIWikiClientCreateOrUpdateResponse struct { + WikiContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// APIWikiClientDeleteResponse contains the response from method APIWikiClient.Delete. +type APIWikiClientDeleteResponse struct { + // placeholder for future response values +} + +// APIWikiClientGetEntityTagResponse contains the response from method APIWikiClient.GetEntityTag. +type APIWikiClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// APIWikiClientGetResponse contains the response from method APIWikiClient.Get. +type APIWikiClientGetResponse struct { + WikiContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// APIWikiClientUpdateResponse contains the response from method APIWikiClient.Update. +type APIWikiClientUpdateResponse struct { + WikiContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// APIWikisClientListResponse contains the response from method APIWikisClient.NewListPager. +type APIWikisClientListResponse struct { + WikiCollection +} + +// AuthorizationAccessPolicyClientCreateOrUpdateResponse contains the response from method AuthorizationAccessPolicyClient.CreateOrUpdate. +type AuthorizationAccessPolicyClientCreateOrUpdateResponse struct { + AuthorizationAccessPolicyContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// AuthorizationAccessPolicyClientDeleteResponse contains the response from method AuthorizationAccessPolicyClient.Delete. +type AuthorizationAccessPolicyClientDeleteResponse struct { + // placeholder for future response values +} + +// AuthorizationAccessPolicyClientGetResponse contains the response from method AuthorizationAccessPolicyClient.Get. +type AuthorizationAccessPolicyClientGetResponse struct { + AuthorizationAccessPolicyContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// AuthorizationAccessPolicyClientListByAuthorizationResponse contains the response from method AuthorizationAccessPolicyClient.NewListByAuthorizationPager. +type AuthorizationAccessPolicyClientListByAuthorizationResponse struct { + AuthorizationAccessPolicyCollection +} + +// AuthorizationClientConfirmConsentCodeResponse contains the response from method AuthorizationClient.ConfirmConsentCode. +type AuthorizationClientConfirmConsentCodeResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// AuthorizationClientCreateOrUpdateResponse contains the response from method AuthorizationClient.CreateOrUpdate. +type AuthorizationClientCreateOrUpdateResponse struct { + AuthorizationContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// AuthorizationClientDeleteResponse contains the response from method AuthorizationClient.Delete. +type AuthorizationClientDeleteResponse struct { + // placeholder for future response values +} + +// AuthorizationClientGetResponse contains the response from method AuthorizationClient.Get. +type AuthorizationClientGetResponse struct { + AuthorizationContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// AuthorizationClientListByAuthorizationProviderResponse contains the response from method AuthorizationClient.NewListByAuthorizationProviderPager. +type AuthorizationClientListByAuthorizationProviderResponse struct { + AuthorizationCollection +} + +// AuthorizationLoginLinksClientPostResponse contains the response from method AuthorizationLoginLinksClient.Post. +type AuthorizationLoginLinksClientPostResponse struct { + AuthorizationLoginResponseContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// AuthorizationProviderClientCreateOrUpdateResponse contains the response from method AuthorizationProviderClient.CreateOrUpdate. +type AuthorizationProviderClientCreateOrUpdateResponse struct { + AuthorizationProviderContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// AuthorizationProviderClientDeleteResponse contains the response from method AuthorizationProviderClient.Delete. +type AuthorizationProviderClientDeleteResponse struct { + // placeholder for future response values +} + +// AuthorizationProviderClientGetResponse contains the response from method AuthorizationProviderClient.Get. +type AuthorizationProviderClientGetResponse struct { + AuthorizationProviderContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// AuthorizationProviderClientListByServiceResponse contains the response from method AuthorizationProviderClient.NewListByServicePager. +type AuthorizationProviderClientListByServiceResponse struct { + AuthorizationProviderCollection +} + // AuthorizationServerClientCreateOrUpdateResponse contains the response from method AuthorizationServerClient.CreateOrUpdate. type AuthorizationServerClientCreateOrUpdateResponse struct { AuthorizationServerContract @@ -783,6 +908,46 @@ type DiagnosticClientUpdateResponse struct { ETag *string } +// DocumentationClientCreateOrUpdateResponse contains the response from method DocumentationClient.CreateOrUpdate. +type DocumentationClientCreateOrUpdateResponse struct { + DocumentationContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// DocumentationClientDeleteResponse contains the response from method DocumentationClient.Delete. +type DocumentationClientDeleteResponse struct { + // placeholder for future response values +} + +// DocumentationClientGetEntityTagResponse contains the response from method DocumentationClient.GetEntityTag. +type DocumentationClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// DocumentationClientGetResponse contains the response from method DocumentationClient.Get. +type DocumentationClientGetResponse struct { + DocumentationContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// DocumentationClientListByServiceResponse contains the response from method DocumentationClient.NewListByServicePager. +type DocumentationClientListByServiceResponse struct { + DocumentationCollection +} + +// DocumentationClientUpdateResponse contains the response from method DocumentationClient.Update. +type DocumentationClientUpdateResponse struct { + DocumentationContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + // EmailTemplateClientCreateOrUpdateResponse contains the response from method EmailTemplateClient.CreateOrUpdate. type EmailTemplateClientCreateOrUpdateResponse struct { EmailTemplateContract @@ -911,11 +1076,21 @@ type GatewayClientGetResponse struct { ETag *string } +// GatewayClientInvalidateDebugCredentialsResponse contains the response from method GatewayClient.InvalidateDebugCredentials. +type GatewayClientInvalidateDebugCredentialsResponse struct { + // placeholder for future response values +} + // GatewayClientListByServiceResponse contains the response from method GatewayClient.NewListByServicePager. type GatewayClientListByServiceResponse struct { GatewayCollection } +// GatewayClientListDebugCredentialsResponse contains the response from method GatewayClient.ListDebugCredentials. +type GatewayClientListDebugCredentialsResponse struct { + GatewayDebugCredentialsContract +} + // GatewayClientListKeysResponse contains the response from method GatewayClient.ListKeys. type GatewayClientListKeysResponse struct { GatewayKeysContract @@ -923,6 +1098,12 @@ type GatewayClientListKeysResponse struct { ETag *string } +// GatewayClientListTraceResponse contains the response from method GatewayClient.ListTrace. +type GatewayClientListTraceResponse struct { + // Trace collected in gateway. + Value map[string]any +} + // GatewayClientRegenerateKeyResponse contains the response from method GatewayClient.RegenerateKey. type GatewayClientRegenerateKeyResponse struct { // placeholder for future response values @@ -999,6 +1180,79 @@ type GlobalSchemaClientListByServiceResponse struct { GlobalSchemaCollection } +// GraphQLAPIResolverClientCreateOrUpdateResponse contains the response from method GraphQLAPIResolverClient.CreateOrUpdate. +type GraphQLAPIResolverClientCreateOrUpdateResponse struct { + ResolverContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// GraphQLAPIResolverClientDeleteResponse contains the response from method GraphQLAPIResolverClient.Delete. +type GraphQLAPIResolverClientDeleteResponse struct { + // placeholder for future response values +} + +// GraphQLAPIResolverClientGetEntityTagResponse contains the response from method GraphQLAPIResolverClient.GetEntityTag. +type GraphQLAPIResolverClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// GraphQLAPIResolverClientGetResponse contains the response from method GraphQLAPIResolverClient.Get. +type GraphQLAPIResolverClientGetResponse struct { + ResolverContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// GraphQLAPIResolverClientListByAPIResponse contains the response from method GraphQLAPIResolverClient.NewListByAPIPager. +type GraphQLAPIResolverClientListByAPIResponse struct { + ResolverCollection +} + +// GraphQLAPIResolverClientUpdateResponse contains the response from method GraphQLAPIResolverClient.Update. +type GraphQLAPIResolverClientUpdateResponse struct { + ResolverContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// GraphQLAPIResolverPolicyClientCreateOrUpdateResponse contains the response from method GraphQLAPIResolverPolicyClient.CreateOrUpdate. +type GraphQLAPIResolverPolicyClientCreateOrUpdateResponse struct { + PolicyContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// GraphQLAPIResolverPolicyClientDeleteResponse contains the response from method GraphQLAPIResolverPolicyClient.Delete. +type GraphQLAPIResolverPolicyClientDeleteResponse struct { + // placeholder for future response values +} + +// GraphQLAPIResolverPolicyClientGetEntityTagResponse contains the response from method GraphQLAPIResolverPolicyClient.GetEntityTag. +type GraphQLAPIResolverPolicyClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// GraphQLAPIResolverPolicyClientGetResponse contains the response from method GraphQLAPIResolverPolicyClient.Get. +type GraphQLAPIResolverPolicyClientGetResponse struct { + PolicyContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// GraphQLAPIResolverPolicyClientListByResolverResponse contains the response from method GraphQLAPIResolverPolicyClient.NewListByResolverPager. +type GraphQLAPIResolverPolicyClientListByResolverResponse struct { + PolicyCollection +} + // GroupClientCreateOrUpdateResponse contains the response from method GroupClient.CreateOrUpdate. type GroupClientCreateOrUpdateResponse struct { GroupContract @@ -1365,7 +1619,7 @@ type PolicyClientGetResponse struct { ETag *string } -// PolicyClientListByServiceResponse contains the response from method PolicyClient.ListByService. +// PolicyClientListByServiceResponse contains the response from method PolicyClient.NewListByServicePager. type PolicyClientListByServiceResponse struct { PolicyCollection } @@ -1375,6 +1629,73 @@ type PolicyDescriptionClientListByServiceResponse struct { PolicyDescriptionCollection } +// PolicyFragmentClientCreateOrUpdateResponse contains the response from method PolicyFragmentClient.BeginCreateOrUpdate. +type PolicyFragmentClientCreateOrUpdateResponse struct { + PolicyFragmentContract +} + +// PolicyFragmentClientDeleteResponse contains the response from method PolicyFragmentClient.Delete. +type PolicyFragmentClientDeleteResponse struct { + // placeholder for future response values +} + +// PolicyFragmentClientGetEntityTagResponse contains the response from method PolicyFragmentClient.GetEntityTag. +type PolicyFragmentClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// PolicyFragmentClientGetResponse contains the response from method PolicyFragmentClient.Get. +type PolicyFragmentClientGetResponse struct { + PolicyFragmentContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// PolicyFragmentClientListByServiceResponse contains the response from method PolicyFragmentClient.NewListByServicePager. +type PolicyFragmentClientListByServiceResponse struct { + PolicyFragmentCollection +} + +// PolicyFragmentClientListReferencesResponse contains the response from method PolicyFragmentClient.ListReferences. +type PolicyFragmentClientListReferencesResponse struct { + ResourceCollection +} + +// PortalConfigClientCreateOrUpdateResponse contains the response from method PortalConfigClient.CreateOrUpdate. +type PortalConfigClientCreateOrUpdateResponse struct { + PortalConfigContract +} + +// PortalConfigClientGetEntityTagResponse contains the response from method PortalConfigClient.GetEntityTag. +type PortalConfigClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// PortalConfigClientGetResponse contains the response from method PortalConfigClient.Get. +type PortalConfigClientGetResponse struct { + PortalConfigContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// PortalConfigClientListByServiceResponse contains the response from method PortalConfigClient.NewListByServicePager. +type PortalConfigClientListByServiceResponse struct { + PortalConfigCollection +} + +// PortalConfigClientUpdateResponse contains the response from method PortalConfigClient.Update. +type PortalConfigClientUpdateResponse struct { + PortalConfigContract +} + // PortalRevisionClientCreateOrUpdateResponse contains the response from method PortalRevisionClient.BeginCreateOrUpdate. type PortalRevisionClientCreateOrUpdateResponse struct { PortalRevisionContract @@ -1462,6 +1783,28 @@ type ProductAPIClientListByProductResponse struct { APICollection } +// ProductAPILinkClientCreateOrUpdateResponse contains the response from method ProductAPILinkClient.CreateOrUpdate. +type ProductAPILinkClientCreateOrUpdateResponse struct { + ProductAPILinkContract +} + +// ProductAPILinkClientDeleteResponse contains the response from method ProductAPILinkClient.Delete. +type ProductAPILinkClientDeleteResponse struct { + // placeholder for future response values +} + +// ProductAPILinkClientGetResponse contains the response from method ProductAPILinkClient.Get. +type ProductAPILinkClientGetResponse struct { + ProductAPILinkContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// ProductAPILinkClientListByProductResponse contains the response from method ProductAPILinkClient.NewListByProductPager. +type ProductAPILinkClientListByProductResponse struct { + ProductAPILinkCollection +} + // ProductClientCreateOrUpdateResponse contains the response from method ProductClient.CreateOrUpdate. type ProductClientCreateOrUpdateResponse struct { ProductContract @@ -1528,6 +1871,28 @@ type ProductGroupClientListByProductResponse struct { GroupCollection } +// ProductGroupLinkClientCreateOrUpdateResponse contains the response from method ProductGroupLinkClient.CreateOrUpdate. +type ProductGroupLinkClientCreateOrUpdateResponse struct { + ProductGroupLinkContract +} + +// ProductGroupLinkClientDeleteResponse contains the response from method ProductGroupLinkClient.Delete. +type ProductGroupLinkClientDeleteResponse struct { + // placeholder for future response values +} + +// ProductGroupLinkClientGetResponse contains the response from method ProductGroupLinkClient.Get. +type ProductGroupLinkClientGetResponse struct { + ProductGroupLinkContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// ProductGroupLinkClientListByProductResponse contains the response from method ProductGroupLinkClient.NewListByProductPager. +type ProductGroupLinkClientListByProductResponse struct { + ProductGroupLinkCollection +} + // ProductPolicyClientCreateOrUpdateResponse contains the response from method ProductPolicyClient.CreateOrUpdate. type ProductPolicyClientCreateOrUpdateResponse struct { PolicyContract @@ -1556,7 +1921,7 @@ type ProductPolicyClientGetResponse struct { ETag *string } -// ProductPolicyClientListByProductResponse contains the response from method ProductPolicyClient.ListByProduct. +// ProductPolicyClientListByProductResponse contains the response from method ProductPolicyClient.NewListByProductPager. type ProductPolicyClientListByProductResponse struct { PolicyCollection } @@ -1566,6 +1931,48 @@ type ProductSubscriptionsClientListResponse struct { SubscriptionCollection } +// ProductWikiClientCreateOrUpdateResponse contains the response from method ProductWikiClient.CreateOrUpdate. +type ProductWikiClientCreateOrUpdateResponse struct { + WikiContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// ProductWikiClientDeleteResponse contains the response from method ProductWikiClient.Delete. +type ProductWikiClientDeleteResponse struct { + // placeholder for future response values +} + +// ProductWikiClientGetEntityTagResponse contains the response from method ProductWikiClient.GetEntityTag. +type ProductWikiClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// ProductWikiClientGetResponse contains the response from method ProductWikiClient.Get. +type ProductWikiClientGetResponse struct { + WikiContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// ProductWikiClientUpdateResponse contains the response from method ProductWikiClient.Update. +type ProductWikiClientUpdateResponse struct { + WikiContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// ProductWikisClientListResponse contains the response from method ProductWikisClient.NewListPager. +type ProductWikisClientListResponse struct { + WikiCollection + // ETag contains the information returned from the ETag header response. + ETag *string +} + // QuotaByCounterKeysClientListByServiceResponse contains the response from method QuotaByCounterKeysClient.ListByService. type QuotaByCounterKeysClientListByServiceResponse struct { QuotaCounterCollection @@ -1686,6 +2093,11 @@ type ServiceClientListResponse struct { ServiceListResult } +// ServiceClientMigrateToStv2Response contains the response from method ServiceClient.BeginMigrateToStv2. +type ServiceClientMigrateToStv2Response struct { + ServiceResource +} + // ServiceClientRestoreResponse contains the response from method ServiceClient.BeginRestore. type ServiceClientRestoreResponse struct { ServiceResource @@ -1810,6 +2222,28 @@ type SubscriptionClientUpdateResponse struct { ETag *string } +// TagAPILinkClientCreateOrUpdateResponse contains the response from method TagAPILinkClient.CreateOrUpdate. +type TagAPILinkClientCreateOrUpdateResponse struct { + TagAPILinkContract +} + +// TagAPILinkClientDeleteResponse contains the response from method TagAPILinkClient.Delete. +type TagAPILinkClientDeleteResponse struct { + // placeholder for future response values +} + +// TagAPILinkClientGetResponse contains the response from method TagAPILinkClient.Get. +type TagAPILinkClientGetResponse struct { + TagAPILinkContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// TagAPILinkClientListByProductResponse contains the response from method TagAPILinkClient.NewListByProductPager. +type TagAPILinkClientListByProductResponse struct { + TagAPILinkCollection +} + // TagClientAssignToAPIResponse contains the response from method TagClient.AssignToAPI. type TagClientAssignToAPIResponse struct { TagContract @@ -1945,16 +2379,60 @@ type TagClientUpdateResponse struct { ETag *string } -// TagResourceClientListByServiceResponse contains the response from method TagResourceClient.NewListByServicePager. -type TagResourceClientListByServiceResponse struct { - TagResourceCollection +// TagOperationLinkClientCreateOrUpdateResponse contains the response from method TagOperationLinkClient.CreateOrUpdate. +type TagOperationLinkClientCreateOrUpdateResponse struct { + TagOperationLinkContract } -// TenantAccessClientCreateResponse contains the response from method TenantAccessClient.Create. -type TenantAccessClientCreateResponse struct { - AccessInformationContract - // ETag contains the information returned from the ETag header response. - ETag *string +// TagOperationLinkClientDeleteResponse contains the response from method TagOperationLinkClient.Delete. +type TagOperationLinkClientDeleteResponse struct { + // placeholder for future response values +} + +// TagOperationLinkClientGetResponse contains the response from method TagOperationLinkClient.Get. +type TagOperationLinkClientGetResponse struct { + TagOperationLinkContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// TagOperationLinkClientListByProductResponse contains the response from method TagOperationLinkClient.NewListByProductPager. +type TagOperationLinkClientListByProductResponse struct { + TagOperationLinkCollection +} + +// TagProductLinkClientCreateOrUpdateResponse contains the response from method TagProductLinkClient.CreateOrUpdate. +type TagProductLinkClientCreateOrUpdateResponse struct { + TagProductLinkContract +} + +// TagProductLinkClientDeleteResponse contains the response from method TagProductLinkClient.Delete. +type TagProductLinkClientDeleteResponse struct { + // placeholder for future response values +} + +// TagProductLinkClientGetResponse contains the response from method TagProductLinkClient.Get. +type TagProductLinkClientGetResponse struct { + TagProductLinkContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// TagProductLinkClientListByProductResponse contains the response from method TagProductLinkClient.NewListByProductPager. +type TagProductLinkClientListByProductResponse struct { + TagProductLinkCollection +} + +// TagResourceClientListByServiceResponse contains the response from method TagResourceClient.NewListByServicePager. +type TagResourceClientListByServiceResponse struct { + TagResourceCollection +} + +// TenantAccessClientCreateResponse contains the response from method TenantAccessClient.Create. +type TenantAccessClientCreateResponse struct { + AccessInformationContract + // ETag contains the information returned from the ETag header response. + ETag *string } // TenantAccessClientGetEntityTagResponse contains the response from method TenantAccessClient.GetEntityTag. @@ -2120,3 +2598,854 @@ type UserSubscriptionClientGetResponse struct { type UserSubscriptionClientListResponse struct { SubscriptionCollection } + +// WorkspaceAPIClientCreateOrUpdateResponse contains the response from method WorkspaceAPIClient.BeginCreateOrUpdate. +type WorkspaceAPIClientCreateOrUpdateResponse struct { + APIContract +} + +// WorkspaceAPIClientDeleteResponse contains the response from method WorkspaceAPIClient.Delete. +type WorkspaceAPIClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceAPIClientGetEntityTagResponse contains the response from method WorkspaceAPIClient.GetEntityTag. +type WorkspaceAPIClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceAPIClientGetResponse contains the response from method WorkspaceAPIClient.Get. +type WorkspaceAPIClientGetResponse struct { + APIContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPIClientListByServiceResponse contains the response from method WorkspaceAPIClient.NewListByServicePager. +type WorkspaceAPIClientListByServiceResponse struct { + APICollection +} + +// WorkspaceAPIClientUpdateResponse contains the response from method WorkspaceAPIClient.Update. +type WorkspaceAPIClientUpdateResponse struct { + APIContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPIExportClientGetResponse contains the response from method WorkspaceAPIExportClient.Get. +type WorkspaceAPIExportClientGetResponse struct { + APIExportResult +} + +// WorkspaceAPIOperationClientCreateOrUpdateResponse contains the response from method WorkspaceAPIOperationClient.CreateOrUpdate. +type WorkspaceAPIOperationClientCreateOrUpdateResponse struct { + OperationContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPIOperationClientDeleteResponse contains the response from method WorkspaceAPIOperationClient.Delete. +type WorkspaceAPIOperationClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceAPIOperationClientGetEntityTagResponse contains the response from method WorkspaceAPIOperationClient.GetEntityTag. +type WorkspaceAPIOperationClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceAPIOperationClientGetResponse contains the response from method WorkspaceAPIOperationClient.Get. +type WorkspaceAPIOperationClientGetResponse struct { + OperationContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPIOperationClientListByAPIResponse contains the response from method WorkspaceAPIOperationClient.NewListByAPIPager. +type WorkspaceAPIOperationClientListByAPIResponse struct { + OperationCollection +} + +// WorkspaceAPIOperationClientUpdateResponse contains the response from method WorkspaceAPIOperationClient.Update. +type WorkspaceAPIOperationClientUpdateResponse struct { + OperationContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPIOperationPolicyClientCreateOrUpdateResponse contains the response from method WorkspaceAPIOperationPolicyClient.CreateOrUpdate. +type WorkspaceAPIOperationPolicyClientCreateOrUpdateResponse struct { + PolicyContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPIOperationPolicyClientDeleteResponse contains the response from method WorkspaceAPIOperationPolicyClient.Delete. +type WorkspaceAPIOperationPolicyClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceAPIOperationPolicyClientGetEntityTagResponse contains the response from method WorkspaceAPIOperationPolicyClient.GetEntityTag. +type WorkspaceAPIOperationPolicyClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceAPIOperationPolicyClientGetResponse contains the response from method WorkspaceAPIOperationPolicyClient.Get. +type WorkspaceAPIOperationPolicyClientGetResponse struct { + PolicyContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPIOperationPolicyClientListByOperationResponse contains the response from method WorkspaceAPIOperationPolicyClient.NewListByOperationPager. +type WorkspaceAPIOperationPolicyClientListByOperationResponse struct { + PolicyCollection +} + +// WorkspaceAPIPolicyClientCreateOrUpdateResponse contains the response from method WorkspaceAPIPolicyClient.CreateOrUpdate. +type WorkspaceAPIPolicyClientCreateOrUpdateResponse struct { + PolicyContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPIPolicyClientDeleteResponse contains the response from method WorkspaceAPIPolicyClient.Delete. +type WorkspaceAPIPolicyClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceAPIPolicyClientGetEntityTagResponse contains the response from method WorkspaceAPIPolicyClient.GetEntityTag. +type WorkspaceAPIPolicyClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceAPIPolicyClientGetResponse contains the response from method WorkspaceAPIPolicyClient.Get. +type WorkspaceAPIPolicyClientGetResponse struct { + PolicyContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPIPolicyClientListByAPIResponse contains the response from method WorkspaceAPIPolicyClient.NewListByAPIPager. +type WorkspaceAPIPolicyClientListByAPIResponse struct { + PolicyCollection +} + +// WorkspaceAPIReleaseClientCreateOrUpdateResponse contains the response from method WorkspaceAPIReleaseClient.CreateOrUpdate. +type WorkspaceAPIReleaseClientCreateOrUpdateResponse struct { + APIReleaseContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPIReleaseClientDeleteResponse contains the response from method WorkspaceAPIReleaseClient.Delete. +type WorkspaceAPIReleaseClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceAPIReleaseClientGetEntityTagResponse contains the response from method WorkspaceAPIReleaseClient.GetEntityTag. +type WorkspaceAPIReleaseClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceAPIReleaseClientGetResponse contains the response from method WorkspaceAPIReleaseClient.Get. +type WorkspaceAPIReleaseClientGetResponse struct { + APIReleaseContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPIReleaseClientListByServiceResponse contains the response from method WorkspaceAPIReleaseClient.NewListByServicePager. +type WorkspaceAPIReleaseClientListByServiceResponse struct { + APIReleaseCollection +} + +// WorkspaceAPIReleaseClientUpdateResponse contains the response from method WorkspaceAPIReleaseClient.Update. +type WorkspaceAPIReleaseClientUpdateResponse struct { + APIReleaseContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPIRevisionClientListByServiceResponse contains the response from method WorkspaceAPIRevisionClient.NewListByServicePager. +type WorkspaceAPIRevisionClientListByServiceResponse struct { + APIRevisionCollection +} + +// WorkspaceAPISchemaClientCreateOrUpdateResponse contains the response from method WorkspaceAPISchemaClient.BeginCreateOrUpdate. +type WorkspaceAPISchemaClientCreateOrUpdateResponse struct { + SchemaContract +} + +// WorkspaceAPISchemaClientDeleteResponse contains the response from method WorkspaceAPISchemaClient.Delete. +type WorkspaceAPISchemaClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceAPISchemaClientGetEntityTagResponse contains the response from method WorkspaceAPISchemaClient.GetEntityTag. +type WorkspaceAPISchemaClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceAPISchemaClientGetResponse contains the response from method WorkspaceAPISchemaClient.Get. +type WorkspaceAPISchemaClientGetResponse struct { + SchemaContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPISchemaClientListByAPIResponse contains the response from method WorkspaceAPISchemaClient.NewListByAPIPager. +type WorkspaceAPISchemaClientListByAPIResponse struct { + SchemaCollection +} + +// WorkspaceAPIVersionSetClientCreateOrUpdateResponse contains the response from method WorkspaceAPIVersionSetClient.CreateOrUpdate. +type WorkspaceAPIVersionSetClientCreateOrUpdateResponse struct { + APIVersionSetContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPIVersionSetClientDeleteResponse contains the response from method WorkspaceAPIVersionSetClient.Delete. +type WorkspaceAPIVersionSetClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceAPIVersionSetClientGetEntityTagResponse contains the response from method WorkspaceAPIVersionSetClient.GetEntityTag. +type WorkspaceAPIVersionSetClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceAPIVersionSetClientGetResponse contains the response from method WorkspaceAPIVersionSetClient.Get. +type WorkspaceAPIVersionSetClientGetResponse struct { + APIVersionSetContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceAPIVersionSetClientListByServiceResponse contains the response from method WorkspaceAPIVersionSetClient.NewListByServicePager. +type WorkspaceAPIVersionSetClientListByServiceResponse struct { + APIVersionSetCollection +} + +// WorkspaceAPIVersionSetClientUpdateResponse contains the response from method WorkspaceAPIVersionSetClient.Update. +type WorkspaceAPIVersionSetClientUpdateResponse struct { + APIVersionSetContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceClientCreateOrUpdateResponse contains the response from method WorkspaceClient.CreateOrUpdate. +type WorkspaceClientCreateOrUpdateResponse struct { + WorkspaceContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceClientDeleteResponse contains the response from method WorkspaceClient.Delete. +type WorkspaceClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceClientGetEntityTagResponse contains the response from method WorkspaceClient.GetEntityTag. +type WorkspaceClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceClientGetResponse contains the response from method WorkspaceClient.Get. +type WorkspaceClientGetResponse struct { + WorkspaceContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceClientListByServiceResponse contains the response from method WorkspaceClient.NewListByServicePager. +type WorkspaceClientListByServiceResponse struct { + WorkspaceCollection +} + +// WorkspaceClientUpdateResponse contains the response from method WorkspaceClient.Update. +type WorkspaceClientUpdateResponse struct { + WorkspaceContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceGlobalSchemaClientCreateOrUpdateResponse contains the response from method WorkspaceGlobalSchemaClient.BeginCreateOrUpdate. +type WorkspaceGlobalSchemaClientCreateOrUpdateResponse struct { + GlobalSchemaContract +} + +// WorkspaceGlobalSchemaClientDeleteResponse contains the response from method WorkspaceGlobalSchemaClient.Delete. +type WorkspaceGlobalSchemaClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceGlobalSchemaClientGetEntityTagResponse contains the response from method WorkspaceGlobalSchemaClient.GetEntityTag. +type WorkspaceGlobalSchemaClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceGlobalSchemaClientGetResponse contains the response from method WorkspaceGlobalSchemaClient.Get. +type WorkspaceGlobalSchemaClientGetResponse struct { + GlobalSchemaContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceGlobalSchemaClientListByServiceResponse contains the response from method WorkspaceGlobalSchemaClient.NewListByServicePager. +type WorkspaceGlobalSchemaClientListByServiceResponse struct { + GlobalSchemaCollection +} + +// WorkspaceGroupClientCreateOrUpdateResponse contains the response from method WorkspaceGroupClient.CreateOrUpdate. +type WorkspaceGroupClientCreateOrUpdateResponse struct { + GroupContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceGroupClientDeleteResponse contains the response from method WorkspaceGroupClient.Delete. +type WorkspaceGroupClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceGroupClientGetEntityTagResponse contains the response from method WorkspaceGroupClient.GetEntityTag. +type WorkspaceGroupClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceGroupClientGetResponse contains the response from method WorkspaceGroupClient.Get. +type WorkspaceGroupClientGetResponse struct { + GroupContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceGroupClientListByServiceResponse contains the response from method WorkspaceGroupClient.NewListByServicePager. +type WorkspaceGroupClientListByServiceResponse struct { + GroupCollection +} + +// WorkspaceGroupClientUpdateResponse contains the response from method WorkspaceGroupClient.Update. +type WorkspaceGroupClientUpdateResponse struct { + GroupContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceGroupUserClientCheckEntityExistsResponse contains the response from method WorkspaceGroupUserClient.CheckEntityExists. +type WorkspaceGroupUserClientCheckEntityExistsResponse struct { + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceGroupUserClientCreateResponse contains the response from method WorkspaceGroupUserClient.Create. +type WorkspaceGroupUserClientCreateResponse struct { + UserContract +} + +// WorkspaceGroupUserClientDeleteResponse contains the response from method WorkspaceGroupUserClient.Delete. +type WorkspaceGroupUserClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceGroupUserClientListResponse contains the response from method WorkspaceGroupUserClient.NewListPager. +type WorkspaceGroupUserClientListResponse struct { + UserCollection +} + +// WorkspaceNamedValueClientCreateOrUpdateResponse contains the response from method WorkspaceNamedValueClient.BeginCreateOrUpdate. +type WorkspaceNamedValueClientCreateOrUpdateResponse struct { + NamedValueContract +} + +// WorkspaceNamedValueClientDeleteResponse contains the response from method WorkspaceNamedValueClient.Delete. +type WorkspaceNamedValueClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceNamedValueClientGetEntityTagResponse contains the response from method WorkspaceNamedValueClient.GetEntityTag. +type WorkspaceNamedValueClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceNamedValueClientGetResponse contains the response from method WorkspaceNamedValueClient.Get. +type WorkspaceNamedValueClientGetResponse struct { + NamedValueContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceNamedValueClientListByServiceResponse contains the response from method WorkspaceNamedValueClient.NewListByServicePager. +type WorkspaceNamedValueClientListByServiceResponse struct { + NamedValueCollection +} + +// WorkspaceNamedValueClientListValueResponse contains the response from method WorkspaceNamedValueClient.ListValue. +type WorkspaceNamedValueClientListValueResponse struct { + NamedValueSecretContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceNamedValueClientRefreshSecretResponse contains the response from method WorkspaceNamedValueClient.BeginRefreshSecret. +type WorkspaceNamedValueClientRefreshSecretResponse struct { + NamedValueContract +} + +// WorkspaceNamedValueClientUpdateResponse contains the response from method WorkspaceNamedValueClient.BeginUpdate. +type WorkspaceNamedValueClientUpdateResponse struct { + NamedValueContract +} + +// WorkspaceNotificationClientCreateOrUpdateResponse contains the response from method WorkspaceNotificationClient.CreateOrUpdate. +type WorkspaceNotificationClientCreateOrUpdateResponse struct { + NotificationContract +} + +// WorkspaceNotificationClientGetResponse contains the response from method WorkspaceNotificationClient.Get. +type WorkspaceNotificationClientGetResponse struct { + NotificationContract +} + +// WorkspaceNotificationClientListByServiceResponse contains the response from method WorkspaceNotificationClient.NewListByServicePager. +type WorkspaceNotificationClientListByServiceResponse struct { + NotificationCollection +} + +// WorkspaceNotificationRecipientEmailClientCheckEntityExistsResponse contains the response from method WorkspaceNotificationRecipientEmailClient.CheckEntityExists. +type WorkspaceNotificationRecipientEmailClientCheckEntityExistsResponse struct { + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceNotificationRecipientEmailClientCreateOrUpdateResponse contains the response from method WorkspaceNotificationRecipientEmailClient.CreateOrUpdate. +type WorkspaceNotificationRecipientEmailClientCreateOrUpdateResponse struct { + RecipientEmailContract +} + +// WorkspaceNotificationRecipientEmailClientDeleteResponse contains the response from method WorkspaceNotificationRecipientEmailClient.Delete. +type WorkspaceNotificationRecipientEmailClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceNotificationRecipientEmailClientListByNotificationResponse contains the response from method WorkspaceNotificationRecipientEmailClient.ListByNotification. +type WorkspaceNotificationRecipientEmailClientListByNotificationResponse struct { + RecipientEmailCollection +} + +// WorkspaceNotificationRecipientUserClientCheckEntityExistsResponse contains the response from method WorkspaceNotificationRecipientUserClient.CheckEntityExists. +type WorkspaceNotificationRecipientUserClientCheckEntityExistsResponse struct { + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceNotificationRecipientUserClientCreateOrUpdateResponse contains the response from method WorkspaceNotificationRecipientUserClient.CreateOrUpdate. +type WorkspaceNotificationRecipientUserClientCreateOrUpdateResponse struct { + RecipientUserContract +} + +// WorkspaceNotificationRecipientUserClientDeleteResponse contains the response from method WorkspaceNotificationRecipientUserClient.Delete. +type WorkspaceNotificationRecipientUserClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceNotificationRecipientUserClientListByNotificationResponse contains the response from method WorkspaceNotificationRecipientUserClient.ListByNotification. +type WorkspaceNotificationRecipientUserClientListByNotificationResponse struct { + RecipientUserCollection +} + +// WorkspacePolicyClientCreateOrUpdateResponse contains the response from method WorkspacePolicyClient.CreateOrUpdate. +type WorkspacePolicyClientCreateOrUpdateResponse struct { + PolicyContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspacePolicyClientDeleteResponse contains the response from method WorkspacePolicyClient.Delete. +type WorkspacePolicyClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspacePolicyClientGetEntityTagResponse contains the response from method WorkspacePolicyClient.GetEntityTag. +type WorkspacePolicyClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspacePolicyClientGetResponse contains the response from method WorkspacePolicyClient.Get. +type WorkspacePolicyClientGetResponse struct { + PolicyContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspacePolicyClientListByAPIResponse contains the response from method WorkspacePolicyClient.NewListByAPIPager. +type WorkspacePolicyClientListByAPIResponse struct { + PolicyCollection +} + +// WorkspacePolicyFragmentClientCreateOrUpdateResponse contains the response from method WorkspacePolicyFragmentClient.BeginCreateOrUpdate. +type WorkspacePolicyFragmentClientCreateOrUpdateResponse struct { + PolicyFragmentContract +} + +// WorkspacePolicyFragmentClientDeleteResponse contains the response from method WorkspacePolicyFragmentClient.Delete. +type WorkspacePolicyFragmentClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspacePolicyFragmentClientGetEntityTagResponse contains the response from method WorkspacePolicyFragmentClient.GetEntityTag. +type WorkspacePolicyFragmentClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspacePolicyFragmentClientGetResponse contains the response from method WorkspacePolicyFragmentClient.Get. +type WorkspacePolicyFragmentClientGetResponse struct { + PolicyFragmentContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspacePolicyFragmentClientListByServiceResponse contains the response from method WorkspacePolicyFragmentClient.NewListByServicePager. +type WorkspacePolicyFragmentClientListByServiceResponse struct { + PolicyFragmentCollection +} + +// WorkspacePolicyFragmentClientListReferencesResponse contains the response from method WorkspacePolicyFragmentClient.ListReferences. +type WorkspacePolicyFragmentClientListReferencesResponse struct { + ResourceCollection +} + +// WorkspaceProductAPILinkClientCreateOrUpdateResponse contains the response from method WorkspaceProductAPILinkClient.CreateOrUpdate. +type WorkspaceProductAPILinkClientCreateOrUpdateResponse struct { + ProductAPILinkContract +} + +// WorkspaceProductAPILinkClientDeleteResponse contains the response from method WorkspaceProductAPILinkClient.Delete. +type WorkspaceProductAPILinkClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceProductAPILinkClientGetResponse contains the response from method WorkspaceProductAPILinkClient.Get. +type WorkspaceProductAPILinkClientGetResponse struct { + ProductAPILinkContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceProductAPILinkClientListByProductResponse contains the response from method WorkspaceProductAPILinkClient.NewListByProductPager. +type WorkspaceProductAPILinkClientListByProductResponse struct { + ProductAPILinkCollection +} + +// WorkspaceProductClientCreateOrUpdateResponse contains the response from method WorkspaceProductClient.CreateOrUpdate. +type WorkspaceProductClientCreateOrUpdateResponse struct { + ProductContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceProductClientDeleteResponse contains the response from method WorkspaceProductClient.Delete. +type WorkspaceProductClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceProductClientGetEntityTagResponse contains the response from method WorkspaceProductClient.GetEntityTag. +type WorkspaceProductClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceProductClientGetResponse contains the response from method WorkspaceProductClient.Get. +type WorkspaceProductClientGetResponse struct { + ProductContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceProductClientListByServiceResponse contains the response from method WorkspaceProductClient.NewListByServicePager. +type WorkspaceProductClientListByServiceResponse struct { + ProductCollection +} + +// WorkspaceProductClientUpdateResponse contains the response from method WorkspaceProductClient.Update. +type WorkspaceProductClientUpdateResponse struct { + ProductContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceProductGroupLinkClientCreateOrUpdateResponse contains the response from method WorkspaceProductGroupLinkClient.CreateOrUpdate. +type WorkspaceProductGroupLinkClientCreateOrUpdateResponse struct { + ProductGroupLinkContract +} + +// WorkspaceProductGroupLinkClientDeleteResponse contains the response from method WorkspaceProductGroupLinkClient.Delete. +type WorkspaceProductGroupLinkClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceProductGroupLinkClientGetResponse contains the response from method WorkspaceProductGroupLinkClient.Get. +type WorkspaceProductGroupLinkClientGetResponse struct { + ProductGroupLinkContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceProductGroupLinkClientListByProductResponse contains the response from method WorkspaceProductGroupLinkClient.NewListByProductPager. +type WorkspaceProductGroupLinkClientListByProductResponse struct { + ProductGroupLinkCollection +} + +// WorkspaceProductPolicyClientCreateOrUpdateResponse contains the response from method WorkspaceProductPolicyClient.CreateOrUpdate. +type WorkspaceProductPolicyClientCreateOrUpdateResponse struct { + PolicyContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceProductPolicyClientDeleteResponse contains the response from method WorkspaceProductPolicyClient.Delete. +type WorkspaceProductPolicyClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceProductPolicyClientGetEntityTagResponse contains the response from method WorkspaceProductPolicyClient.GetEntityTag. +type WorkspaceProductPolicyClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceProductPolicyClientGetResponse contains the response from method WorkspaceProductPolicyClient.Get. +type WorkspaceProductPolicyClientGetResponse struct { + PolicyContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceProductPolicyClientListByProductResponse contains the response from method WorkspaceProductPolicyClient.ListByProduct. +type WorkspaceProductPolicyClientListByProductResponse struct { + PolicyCollection +} + +// WorkspaceSubscriptionClientCreateOrUpdateResponse contains the response from method WorkspaceSubscriptionClient.CreateOrUpdate. +type WorkspaceSubscriptionClientCreateOrUpdateResponse struct { + SubscriptionContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceSubscriptionClientDeleteResponse contains the response from method WorkspaceSubscriptionClient.Delete. +type WorkspaceSubscriptionClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceSubscriptionClientGetEntityTagResponse contains the response from method WorkspaceSubscriptionClient.GetEntityTag. +type WorkspaceSubscriptionClientGetEntityTagResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceSubscriptionClientGetResponse contains the response from method WorkspaceSubscriptionClient.Get. +type WorkspaceSubscriptionClientGetResponse struct { + SubscriptionContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceSubscriptionClientListResponse contains the response from method WorkspaceSubscriptionClient.NewListPager. +type WorkspaceSubscriptionClientListResponse struct { + SubscriptionCollection +} + +// WorkspaceSubscriptionClientListSecretsResponse contains the response from method WorkspaceSubscriptionClient.ListSecrets. +type WorkspaceSubscriptionClientListSecretsResponse struct { + SubscriptionKeysContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceSubscriptionClientRegeneratePrimaryKeyResponse contains the response from method WorkspaceSubscriptionClient.RegeneratePrimaryKey. +type WorkspaceSubscriptionClientRegeneratePrimaryKeyResponse struct { + // placeholder for future response values +} + +// WorkspaceSubscriptionClientRegenerateSecondaryKeyResponse contains the response from method WorkspaceSubscriptionClient.RegenerateSecondaryKey. +type WorkspaceSubscriptionClientRegenerateSecondaryKeyResponse struct { + // placeholder for future response values +} + +// WorkspaceSubscriptionClientUpdateResponse contains the response from method WorkspaceSubscriptionClient.Update. +type WorkspaceSubscriptionClientUpdateResponse struct { + SubscriptionContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceTagAPILinkClientCreateOrUpdateResponse contains the response from method WorkspaceTagAPILinkClient.CreateOrUpdate. +type WorkspaceTagAPILinkClientCreateOrUpdateResponse struct { + TagAPILinkContract +} + +// WorkspaceTagAPILinkClientDeleteResponse contains the response from method WorkspaceTagAPILinkClient.Delete. +type WorkspaceTagAPILinkClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceTagAPILinkClientGetResponse contains the response from method WorkspaceTagAPILinkClient.Get. +type WorkspaceTagAPILinkClientGetResponse struct { + TagAPILinkContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceTagAPILinkClientListByProductResponse contains the response from method WorkspaceTagAPILinkClient.NewListByProductPager. +type WorkspaceTagAPILinkClientListByProductResponse struct { + TagAPILinkCollection +} + +// WorkspaceTagClientCreateOrUpdateResponse contains the response from method WorkspaceTagClient.CreateOrUpdate. +type WorkspaceTagClientCreateOrUpdateResponse struct { + TagContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceTagClientDeleteResponse contains the response from method WorkspaceTagClient.Delete. +type WorkspaceTagClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceTagClientGetEntityStateResponse contains the response from method WorkspaceTagClient.GetEntityState. +type WorkspaceTagClientGetEntityStateResponse struct { + // ETag contains the information returned from the ETag header response. + ETag *string + + // Success indicates if the operation succeeded or failed. + Success bool +} + +// WorkspaceTagClientGetResponse contains the response from method WorkspaceTagClient.Get. +type WorkspaceTagClientGetResponse struct { + TagContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceTagClientListByServiceResponse contains the response from method WorkspaceTagClient.NewListByServicePager. +type WorkspaceTagClientListByServiceResponse struct { + TagCollection +} + +// WorkspaceTagClientUpdateResponse contains the response from method WorkspaceTagClient.Update. +type WorkspaceTagClientUpdateResponse struct { + TagContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceTagOperationLinkClientCreateOrUpdateResponse contains the response from method WorkspaceTagOperationLinkClient.CreateOrUpdate. +type WorkspaceTagOperationLinkClientCreateOrUpdateResponse struct { + TagOperationLinkContract +} + +// WorkspaceTagOperationLinkClientDeleteResponse contains the response from method WorkspaceTagOperationLinkClient.Delete. +type WorkspaceTagOperationLinkClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceTagOperationLinkClientGetResponse contains the response from method WorkspaceTagOperationLinkClient.Get. +type WorkspaceTagOperationLinkClientGetResponse struct { + TagOperationLinkContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceTagOperationLinkClientListByProductResponse contains the response from method WorkspaceTagOperationLinkClient.NewListByProductPager. +type WorkspaceTagOperationLinkClientListByProductResponse struct { + TagOperationLinkCollection +} + +// WorkspaceTagProductLinkClientCreateOrUpdateResponse contains the response from method WorkspaceTagProductLinkClient.CreateOrUpdate. +type WorkspaceTagProductLinkClientCreateOrUpdateResponse struct { + TagProductLinkContract +} + +// WorkspaceTagProductLinkClientDeleteResponse contains the response from method WorkspaceTagProductLinkClient.Delete. +type WorkspaceTagProductLinkClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkspaceTagProductLinkClientGetResponse contains the response from method WorkspaceTagProductLinkClient.Get. +type WorkspaceTagProductLinkClientGetResponse struct { + TagProductLinkContract + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// WorkspaceTagProductLinkClientListByProductResponse contains the response from method WorkspaceTagProductLinkClient.NewListByProductPager. +type WorkspaceTagProductLinkClientListByProductResponse struct { + TagProductLinkCollection +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/service_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/service_client.go index 427fb118ffcd..26475551f29a 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/service_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/service_client.go @@ -29,8 +29,7 @@ type ServiceClient struct { } // NewServiceClient creates a new instance of ServiceClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewServiceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServiceClient, error) { @@ -49,8 +48,8 @@ func NewServiceClient(subscriptionID string, credential azcore.TokenCredential, // pick the updated DNS changes. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - ServiceClientBeginApplyNetworkConfigurationUpdatesOptions contains the optional parameters for the ServiceClient.BeginApplyNetworkConfigurationUpdates // method. @@ -72,7 +71,7 @@ func (client *ServiceClient) BeginApplyNetworkConfigurationUpdates(ctx context.C // the updated DNS changes. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *ServiceClient) applyNetworkConfigurationUpdates(ctx context.Context, resourceGroupName string, serviceName string, options *ServiceClientBeginApplyNetworkConfigurationUpdatesOptions) (*http.Response, error) { req, err := client.applyNetworkConfigurationUpdatesCreateRequest(ctx, resourceGroupName, serviceName, options) if err != nil { @@ -108,7 +107,7 @@ func (client *ServiceClient) applyNetworkConfigurationUpdatesCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Parameters != nil { @@ -121,8 +120,8 @@ func (client *ServiceClient) applyNetworkConfigurationUpdatesCreateRequest(ctx c // and could take several minutes to complete. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - parameters - Parameters supplied to the ApiManagementService_Backup operation. // - options - ServiceClientBeginBackupOptions contains the optional parameters for the ServiceClient.BeginBackup method. @@ -144,7 +143,7 @@ func (client *ServiceClient) BeginBackup(ctx context.Context, resourceGroupName // and could take several minutes to complete. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *ServiceClient) backup(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters, options *ServiceClientBeginBackupOptions) (*http.Response, error) { req, err := client.backupCreateRequest(ctx, resourceGroupName, serviceName, parameters, options) if err != nil { @@ -180,7 +179,7 @@ func (client *ServiceClient) backupCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -189,7 +188,7 @@ func (client *ServiceClient) backupCreateRequest(ctx context.Context, resourceGr // CheckNameAvailability - Checks availability and correctness of a name for an API Management service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview // - parameters - Parameters supplied to the CheckNameAvailability operation. // - options - ServiceClientCheckNameAvailabilityOptions contains the optional parameters for the ServiceClient.CheckNameAvailability // method. @@ -220,7 +219,7 @@ func (client *ServiceClient) checkNameAvailabilityCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -239,8 +238,8 @@ func (client *ServiceClient) checkNameAvailabilityHandleResponse(resp *http.Resp // minutes to complete. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - parameters - Parameters supplied to the CreateOrUpdate API Management service operation. // - options - ServiceClientBeginCreateOrUpdateOptions contains the optional parameters for the ServiceClient.BeginCreateOrUpdate @@ -261,7 +260,7 @@ func (client *ServiceClient) BeginCreateOrUpdate(ctx context.Context, resourceGr // to complete. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *ServiceClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceResource, options *ServiceClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, parameters, options) if err != nil { @@ -271,7 +270,7 @@ func (client *ServiceClient) createOrUpdate(ctx context.Context, resourceGroupNa if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, runtime.NewResponseError(resp) } return resp, nil @@ -297,7 +296,7 @@ func (client *ServiceClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -306,8 +305,8 @@ func (client *ServiceClient) createOrUpdateCreateRequest(ctx context.Context, re // BeginDelete - Deletes an existing API Management service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - ServiceClientBeginDeleteOptions contains the optional parameters for the ServiceClient.BeginDelete method. func (client *ServiceClient) BeginDelete(ctx context.Context, resourceGroupName string, serviceName string, options *ServiceClientBeginDeleteOptions) (*runtime.Poller[ServiceClientDeleteResponse], error) { @@ -325,7 +324,7 @@ func (client *ServiceClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes an existing API Management service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *ServiceClient) deleteOperation(ctx context.Context, resourceGroupName string, serviceName string, options *ServiceClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, options) if err != nil { @@ -361,7 +360,7 @@ func (client *ServiceClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -370,8 +369,8 @@ func (client *ServiceClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Gets an API Management service resource description. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - ServiceClientGetOptions contains the optional parameters for the ServiceClient.Get method. func (client *ServiceClient) Get(ctx context.Context, resourceGroupName string, serviceName string, options *ServiceClientGetOptions) (ServiceClientGetResponse, error) { @@ -409,7 +408,7 @@ func (client *ServiceClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -427,7 +426,7 @@ func (client *ServiceClient) getHandleResponse(resp *http.Response) (ServiceClie // GetDomainOwnershipIdentifier - Get the custom domain ownership identifier for an API Management service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview // - options - ServiceClientGetDomainOwnershipIdentifierOptions contains the optional parameters for the ServiceClient.GetDomainOwnershipIdentifier // method. func (client *ServiceClient) GetDomainOwnershipIdentifier(ctx context.Context, options *ServiceClientGetDomainOwnershipIdentifierOptions) (ServiceClientGetDomainOwnershipIdentifierResponse, error) { @@ -457,7 +456,7 @@ func (client *ServiceClient) getDomainOwnershipIdentifierCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -475,8 +474,8 @@ func (client *ServiceClient) getDomainOwnershipIdentifierHandleResponse(resp *ht // GetSsoToken - Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - ServiceClientGetSsoTokenOptions contains the optional parameters for the ServiceClient.GetSsoToken method. func (client *ServiceClient) GetSsoToken(ctx context.Context, resourceGroupName string, serviceName string, options *ServiceClientGetSsoTokenOptions) (ServiceClientGetSsoTokenResponse, error) { @@ -514,7 +513,7 @@ func (client *ServiceClient) getSsoTokenCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -531,7 +530,7 @@ func (client *ServiceClient) getSsoTokenHandleResponse(resp *http.Response) (Ser // NewListPager - Lists all API Management services within an Azure subscription. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview // - options - ServiceClientListOptions contains the optional parameters for the ServiceClient.NewListPager method. func (client *ServiceClient) NewListPager(options *ServiceClientListOptions) *runtime.Pager[ServiceClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ServiceClientListResponse]{ @@ -573,7 +572,7 @@ func (client *ServiceClient) listCreateRequest(ctx context.Context, options *Ser return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -590,8 +589,8 @@ func (client *ServiceClient) listHandleResponse(resp *http.Response) (ServiceCli // NewListByResourceGroupPager - List all API Management services within a resource group. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ServiceClientListByResourceGroupOptions contains the optional parameters for the ServiceClient.NewListByResourceGroupPager // method. func (client *ServiceClient) NewListByResourceGroupPager(resourceGroupName string, options *ServiceClientListByResourceGroupOptions) *runtime.Pager[ServiceClientListByResourceGroupResponse] { @@ -638,7 +637,7 @@ func (client *ServiceClient) listByResourceGroupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -653,13 +652,87 @@ func (client *ServiceClient) listByResourceGroupHandleResponse(resp *http.Respon return result, nil } +// BeginMigrateToStv2 - Upgrades an API Management service to the Stv2 platform. For details refer to https://aka.ms/apim-migrate-stv2. +// This change is not reversible. This is long running operation and could take several +// minutes to complete. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - options - ServiceClientBeginMigrateToStv2Options contains the optional parameters for the ServiceClient.BeginMigrateToStv2 +// method. +func (client *ServiceClient) BeginMigrateToStv2(ctx context.Context, resourceGroupName string, serviceName string, options *ServiceClientBeginMigrateToStv2Options) (*runtime.Poller[ServiceClientMigrateToStv2Response], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.migrateToStv2(ctx, resourceGroupName, serviceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServiceClientMigrateToStv2Response]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ServiceClientMigrateToStv2Response](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// MigrateToStv2 - Upgrades an API Management service to the Stv2 platform. For details refer to https://aka.ms/apim-migrate-stv2. +// This change is not reversible. This is long running operation and could take several +// minutes to complete. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +func (client *ServiceClient) migrateToStv2(ctx context.Context, resourceGroupName string, serviceName string, options *ServiceClientBeginMigrateToStv2Options) (*http.Response, error) { + req, err := client.migrateToStv2CreateRequest(ctx, resourceGroupName, serviceName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// migrateToStv2CreateRequest creates the MigrateToStv2 request. +func (client *ServiceClient) migrateToStv2CreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *ServiceClientBeginMigrateToStv2Options) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + // BeginRestore - Restores a backup of an API Management service created using the ApiManagementService_Backup operation on // the current service. This is a long running operation and could take several minutes to // complete. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - parameters - Parameters supplied to the Restore API Management service from backup operation. // - options - ServiceClientBeginRestoreOptions contains the optional parameters for the ServiceClient.BeginRestore method. @@ -682,7 +755,7 @@ func (client *ServiceClient) BeginRestore(ctx context.Context, resourceGroupName // complete. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *ServiceClient) restore(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters, options *ServiceClientBeginRestoreOptions) (*http.Response, error) { req, err := client.restoreCreateRequest(ctx, resourceGroupName, serviceName, parameters, options) if err != nil { @@ -718,7 +791,7 @@ func (client *ServiceClient) restoreCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -727,8 +800,8 @@ func (client *ServiceClient) restoreCreateRequest(ctx context.Context, resourceG // BeginUpdate - Updates an existing API Management service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - parameters - Parameters supplied to the CreateOrUpdate API Management service operation. // - options - ServiceClientBeginUpdateOptions contains the optional parameters for the ServiceClient.BeginUpdate method. @@ -747,7 +820,7 @@ func (client *ServiceClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Updates an existing API Management service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *ServiceClient) update(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceUpdateParameters, options *ServiceClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, parameters, options) if err != nil { @@ -783,7 +856,7 @@ func (client *ServiceClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/service_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/service_client_example_test.go deleted file mode 100644 index 68055e6f6d13..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/service_client_example_test.go +++ /dev/null @@ -1,3095 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementRestoreWithAccessKey.json -func ExampleServiceClient_BeginRestore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginRestore(ctx, "rg1", "apimService1", armapimanagement.ServiceBackupRestoreParameters{ - AccessKey: to.Ptr("**************************************************"), - AccessType: to.Ptr(armapimanagement.AccessTypeAccessKey), - BackupName: to.Ptr("apimService1backup_2017_03_19"), - ContainerName: to.Ptr("backupContainer"), - StorageAccount: to.Ptr("teststorageaccount"), - }, 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // "tag3": to.Ptr("value3"), - // }, - // Etag: to.Ptr("AAAAAAACXok="), - // Location: to.Ptr("West US"), - // Properties: &armapimanagement.ServiceProperties{ - // AdditionalLocations: []*armapimanagement.AdditionalLocation{ - // { - // DisableGateway: to.Ptr(true), - // GatewayRegionalURL: to.Ptr("https://apimService1-eastus-01.regional.azure-api.net"), - // Location: to.Ptr("East US"), - // PublicIPAddresses: []*string{ - // to.Ptr("23.101.138.153")}, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // }}, - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // MinAPIVersion: to.Ptr("2019-01-01"), - // }, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-18T06:26:20.3348609Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DeveloperPortalURL: to.Ptr("https://apimService1.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimService1-westus-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2036-01-01T07:00:00+00:00"); return t}()), - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("8E989XXXXXXXXXXXXXXXXB9C2C91F1D174FDB3A2"), - // }, - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("gateway1.msitesting.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeManagement), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2036-01-01T07:00:00+00:00"); return t}()), - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("8E989XXXXXXXXXXXXXXXXB9C2C91F1D174FDB3A2"), - // }, - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("mgmt.msitesting.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypePortal), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2036-01-01T07:00:00+00:00"); return t}()), - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("8E989XXXXXXXXXXXXXXXXB9C2C91F1D174FDB3A2"), - // }, - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("portal1.msitesting.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("13.91.32.113")}, - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("apim@autorestsdk.com"), - // PublisherName: to.Ptr("autorestsdk"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementBackupWithAccessKey.json -func ExampleServiceClient_BeginBackup_apiManagementBackupWithAccessKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginBackup(ctx, "rg1", "apimService1", armapimanagement.ServiceBackupRestoreParameters{ - AccessKey: to.Ptr("**************************************************"), - AccessType: to.Ptr(armapimanagement.AccessTypeAccessKey), - BackupName: to.Ptr("apimService1backup_2017_03_19"), - ContainerName: to.Ptr("backupContainer"), - StorageAccount: to.Ptr("teststorageaccount"), - }, 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // "tag3": to.Ptr("value3"), - // }, - // Etag: to.Ptr("AAAAAAACXok="), - // Location: to.Ptr("West US"), - // Properties: &armapimanagement.ServiceProperties{ - // AdditionalLocations: []*armapimanagement.AdditionalLocation{ - // { - // DisableGateway: to.Ptr(true), - // GatewayRegionalURL: to.Ptr("https://apimService1-eastus-01.regional.azure-api.net"), - // Location: to.Ptr("East US"), - // PublicIPAddresses: []*string{ - // to.Ptr("23.101.138.153")}, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // }}, - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // MinAPIVersion: to.Ptr("2019-01-01"), - // }, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-18T06:26:20.3348609Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DeveloperPortalURL: to.Ptr("https://apimService1.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimService1-westus-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2036-01-01T07:00:00+00:00"); return t}()), - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("8E989XXXXXXXXXXXXXXXXB9C2C91F1D174FDB3A2"), - // }, - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("gateway1.msitesting.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeManagement), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2036-01-01T07:00:00+00:00"); return t}()), - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("8E989XXXXXXXXXXXXXXXXB9C2C91F1D174FDB3A2"), - // }, - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("mgmt.msitesting.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypePortal), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2036-01-01T07:00:00+00:00"); return t}()), - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("8E989XXXXXXXXXXXXXXXXB9C2C91F1D174FDB3A2"), - // }, - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("portal1.msitesting.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("13.91.32.113")}, - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("apim@autorestsdk.com"), - // PublisherName: to.Ptr("autorestsdk"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementBackupWithSystemManagedIdentity.json -func ExampleServiceClient_BeginBackup_apiManagementBackupWithSystemManagedIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginBackup(ctx, "rg1", "apimService1", armapimanagement.ServiceBackupRestoreParameters{ - AccessType: to.Ptr(armapimanagement.AccessTypeSystemAssignedManagedIdentity), - BackupName: to.Ptr("backup5"), - ContainerName: to.Ptr("apim-backups"), - StorageAccount: to.Ptr("contosorpstorage"), - }, 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "Owner": to.Ptr("apimService1"), - // }, - // Etag: to.Ptr("AAAAAAAQM8o="), - // Identity: &armapimanagement.ServiceIdentity{ - // Type: to.Ptr(armapimanagement.ApimIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("XXXXX-5fb4-4916-95d4-64b306f9d924"), - // TenantID: to.Ptr("XXXXX-86f1-XXXXX-91ab-2d7cd011db47"), - // UserAssignedIdentities: map[string]*armapimanagement.UserIdentityProperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/rg1UserIdentity": &armapimanagement.UserIdentityProperties{ - // ClientID: to.Ptr("XXXXX-a154-4830-XXXX-46a12da1a1e2"), - // PrincipalID: to.Ptr("XXXXX-a100-4478-XXXX-d65d98118ba0"), - // }, - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/vpnpremium": &armapimanagement.UserIdentityProperties{ - // ClientID: to.Ptr("XXXX-6328-4db2-XXXX-ab0e3e7806cf"), - // PrincipalID: to.Ptr("XXXXX-9208-4128-af2d-a10d2af9b5a3"), - // }, - // }, - // }, - // Location: to.Ptr("Central US EUAP"), - // Properties: &armapimanagement.ServiceProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-23T16:26:47.8637967Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DeveloperPortalURL: to.Ptr("https://apimService1.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimService1-centraluseuap-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PlatformVersion: to.Ptr(armapimanagement.PlatformVersionStv1), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("52.XXXX.160.66")}, - // PublicNetworkAccess: to.Ptr(armapimanagement.PublicNetworkAccessEnabled), - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("apimService1@corp.microsoft.com"), - // PublisherName: to.Ptr("MS"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // SystemData: &armapimanagement.SystemData{ - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-30T06:24:57.0008037Z"); return t}()), - // LastModifiedBy: to.Ptr("contoso@microsoft.com"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementBackupWithUserAssignedManagedIdentity.json -func ExampleServiceClient_BeginBackup_apiManagementBackupWithUserAssignedManagedIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginBackup(ctx, "rg1", "apimService1", armapimanagement.ServiceBackupRestoreParameters{ - AccessType: to.Ptr(armapimanagement.AccessTypeUserAssignedManagedIdentity), - BackupName: to.Ptr("backup5"), - ClientID: to.Ptr("XXXXX-a154-4830-XXXX-46a12da1a1e2"), - ContainerName: to.Ptr("apim-backups"), - StorageAccount: to.Ptr("contosorpstorage"), - }, 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "Owner": to.Ptr("apimService1"), - // }, - // Etag: to.Ptr("AAAAAAAQM8o="), - // Identity: &armapimanagement.ServiceIdentity{ - // Type: to.Ptr(armapimanagement.ApimIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("XXXXX-5fb4-4916-95d4-64b306f9d924"), - // TenantID: to.Ptr("XXXXX-86f1-XXXXX-91ab-2d7cd011db47"), - // UserAssignedIdentities: map[string]*armapimanagement.UserIdentityProperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/rg1UserIdentity": &armapimanagement.UserIdentityProperties{ - // ClientID: to.Ptr("XXXXX-a154-4830-XXXX-46a12da1a1e2"), - // PrincipalID: to.Ptr("XXXXX-a100-4478-XXXX-d65d98118ba0"), - // }, - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/vpnpremium": &armapimanagement.UserIdentityProperties{ - // ClientID: to.Ptr("XXXX-6328-4db2-XXXX-ab0e3e7806cf"), - // PrincipalID: to.Ptr("XXXXX-9208-4128-af2d-a10d2af9b5a3"), - // }, - // }, - // }, - // Location: to.Ptr("Central US EUAP"), - // Properties: &armapimanagement.ServiceProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-23T16:26:47.8637967Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DeveloperPortalURL: to.Ptr("https://apimService1.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimService1-centraluseuap-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PlatformVersion: to.Ptr(armapimanagement.PlatformVersionStv1), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("52.XXXX.160.66")}, - // PublicNetworkAccess: to.Ptr(armapimanagement.PublicNetworkAccessEnabled), - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("apimService1@corp.microsoft.com"), - // PublisherName: to.Ptr("MS"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // SystemData: &armapimanagement.SystemData{ - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-30T06:24:57.0008037Z"); return t}()), - // LastModifiedBy: to.Ptr("contoso@microsoft.com"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateMultiRegionServiceWithCustomHostname.json -func ExampleServiceClient_BeginCreateOrUpdate_apiManagementCreateMultiRegionServiceWithCustomHostname() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.ServiceResource{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - "tag3": to.Ptr("value3"), - }, - Location: to.Ptr("West US"), - Properties: &armapimanagement.ServiceProperties{ - AdditionalLocations: []*armapimanagement.AdditionalLocation{ - { - DisableGateway: to.Ptr(true), - Location: to.Ptr("East US"), - SKU: &armapimanagement.ServiceSKUProperties{ - Name: to.Ptr(armapimanagement.SKUTypePremium), - Capacity: to.Ptr[int32](1), - }, - }}, - APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - MinAPIVersion: to.Ptr("2019-01-01"), - }, - HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - { - Type: to.Ptr(armapimanagement.HostnameTypeProxy), - CertificatePassword: to.Ptr("Password"), - DefaultSSLBinding: to.Ptr(true), - EncodedCertificate: to.Ptr("****** Base 64 Encoded Certificate ************"), - HostName: to.Ptr("gateway1.msitesting.net"), - }, - { - Type: to.Ptr(armapimanagement.HostnameTypeManagement), - CertificatePassword: to.Ptr("Password"), - EncodedCertificate: to.Ptr("****** Base 64 Encoded Certificate ************"), - HostName: to.Ptr("mgmt.msitesting.net"), - }, - { - Type: to.Ptr(armapimanagement.HostnameTypePortal), - CertificatePassword: to.Ptr("Password"), - EncodedCertificate: to.Ptr("****** Base 64 Encoded Certificate ************"), - HostName: to.Ptr("portal1.msitesting.net"), - }}, - VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - PublisherEmail: to.Ptr("apim@autorestsdk.com"), - PublisherName: to.Ptr("autorestsdk"), - }, - SKU: &armapimanagement.ServiceSKUProperties{ - Name: to.Ptr(armapimanagement.SKUTypePremium), - Capacity: to.Ptr[int32](1), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // "tag3": to.Ptr("value3"), - // }, - // Etag: to.Ptr("AAAAAAACXok="), - // Location: to.Ptr("West US"), - // Properties: &armapimanagement.ServiceProperties{ - // AdditionalLocations: []*armapimanagement.AdditionalLocation{ - // { - // DisableGateway: to.Ptr(true), - // GatewayRegionalURL: to.Ptr("https://apimService1-eastus-01.regional.azure-api.net"), - // Location: to.Ptr("East US"), - // PublicIPAddresses: []*string{ - // to.Ptr("23.101.138.153")}, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // }}, - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // MinAPIVersion: to.Ptr("2019-01-01"), - // }, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-18T06:26:20.3348609Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DeveloperPortalURL: to.Ptr("https://apimService1.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimService1-westus-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2036-01-01T07:00:00+00:00"); return t}()), - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("8E989XXXXXXXXXXXXXXXXF1D174FDB3A2"), - // }, - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("gateway1.msitesting.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeManagement), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2036-01-01T07:00:00+00:00"); return t}()), - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("8E989XXXXXXXXXXXXXXXXF1D174FDB3A2"), - // }, - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("mgmt.msitesting.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypePortal), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2036-01-01T07:00:00+00:00"); return t}()), - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("8E989XXXXXXXXXXXXXXXXF1D174FDB3A2"), - // }, - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("portal1.msitesting.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("13.91.32.113")}, - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("apim@autorestsdk.com"), - // PublisherName: to.Ptr("autorestsdk"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateService.json -func ExampleServiceClient_BeginCreateOrUpdate_apiManagementCreateService() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.ServiceResource{ - Tags: map[string]*string{ - "Name": to.Ptr("Contoso"), - "Test": to.Ptr("User"), - }, - Location: to.Ptr("South Central US"), - Properties: &armapimanagement.ServiceProperties{ - PublisherEmail: to.Ptr("foo@contoso.com"), - PublisherName: to.Ptr("foo"), - }, - SKU: &armapimanagement.ServiceSKUProperties{ - Name: to.Ptr(armapimanagement.SKUTypeDeveloper), - Capacity: to.Ptr[int32](1), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "Name": to.Ptr("Contoso"), - // "Test": to.Ptr("User"), - // }, - // Etag: to.Ptr("AAAAAAAp3T4="), - // Location: to.Ptr("South Central US"), - // Properties: &armapimanagement.ServiceProperties{ - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // }, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-18T06:10:56.0327105Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DeveloperPortalURL: to.Ptr("https://apimService1.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimService1-southcentralus-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("23.102.171.124")}, - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("foo@contoso.com"), - // PublisherName: to.Ptr("foo"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypeDeveloper), - // Capacity: to.Ptr[int32](1), - // }, - // SystemData: &armapimanagement.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armapimanagement.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeApplication), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceHavingMsi.json -func ExampleServiceClient_BeginCreateOrUpdate_apiManagementCreateServiceHavingMsi() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.ServiceResource{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - "tag3": to.Ptr("value3"), - }, - Identity: &armapimanagement.ServiceIdentity{ - Type: to.Ptr(armapimanagement.ApimIdentityTypeSystemAssigned), - }, - Location: to.Ptr("West US"), - Properties: &armapimanagement.ServiceProperties{ - PublisherEmail: to.Ptr("apim@autorestsdk.com"), - PublisherName: to.Ptr("autorestsdk"), - }, - SKU: &armapimanagement.ServiceSKUProperties{ - Name: to.Ptr(armapimanagement.SKUTypeConsumption), - Capacity: to.Ptr[int32](0), - }, - }, 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // "tag3": to.Ptr("value3"), - // }, - // Etag: to.Ptr("AAAAAAAAWiU="), - // Identity: &armapimanagement.ServiceIdentity{ - // Type: to.Ptr(armapimanagement.ApimIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("dfb9a757-df69-4966-a8d0-711a9cd8ffb4"), - // TenantID: to.Ptr("XXXXXX-86f1-41af-91ab-2d7cd011db47"), - // }, - // Location: to.Ptr("West US"), - // Properties: &armapimanagement.ServiceProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-11T16:29:29.9711098Z"); return t}()), - // EnableClientCertificate: to.Ptr(false), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PlatformVersion: to.Ptr(armapimanagement.PlatformVersionMtv1), - // ProvisioningState: to.Ptr("Succeeded"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("apim@autorestsdk.com"), - // PublisherName: to.Ptr("autorestsdk"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypeConsumption), - // Capacity: to.Ptr[int32](0), - // }, - // SystemData: &armapimanagement.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armapimanagement.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeApplication), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceInVnetWithPublicIP.json -func ExampleServiceClient_BeginCreateOrUpdate_apiManagementCreateServiceInVnetWithPublicIp() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.ServiceResource{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - "tag3": to.Ptr("value3"), - }, - Location: to.Ptr("East US 2 EUAP"), - Properties: &armapimanagement.ServiceProperties{ - PublicIPAddressID: to.Ptr("/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.Network/publicIPAddresses/apimazvnet"), - VirtualNetworkConfiguration: &armapimanagement.VirtualNetworkConfiguration{ - SubnetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.Network/virtualNetworks/apimcus/subnets/tenant"), - }, - VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeExternal), - PublisherEmail: to.Ptr("apim@autorestsdk.com"), - PublisherName: to.Ptr("autorestsdk"), - }, - SKU: &armapimanagement.ServiceSKUProperties{ - Name: to.Ptr(armapimanagement.SKUTypePremium), - Capacity: to.Ptr[int32](2), - }, - Zones: []*string{ - to.Ptr("1"), - to.Ptr("2")}, - }, 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // "tag3": to.Ptr("value3"), - // }, - // Etag: to.Ptr("AAAAAAAGTAs="), - // Location: to.Ptr("East US 2 EUAP"), - // Properties: &armapimanagement.ServiceProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-22T06:53:46.6409875Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DeveloperPortalURL: to.Ptr("https://apimService1.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimService1-eastus2euap-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PlatformVersion: to.Ptr(armapimanagement.PlatformVersionStv2), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("20.47.137.XXX")}, - // PublicIPAddressID: to.Ptr("/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.Network/publicIPAddresses/apimazvnet"), - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkConfiguration: &armapimanagement.VirtualNetworkConfiguration{ - // SubnetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.Network/virtualNetworks/apimcus/subnets/tenant"), - // }, - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeExternal), - // PublisherEmail: to.Ptr("apim@autorestsdk.com"), - // PublisherName: to.Ptr("autorestsdk"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](2), - // }, - // SystemData: &armapimanagement.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armapimanagement.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeApplication), - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceInZones.json -func ExampleServiceClient_BeginCreateOrUpdate_apiManagementCreateServiceInZones() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.ServiceResource{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - "tag3": to.Ptr("value3"), - }, - Location: to.Ptr("North europe"), - Properties: &armapimanagement.ServiceProperties{ - PublisherEmail: to.Ptr("apim@autorestsdk.com"), - PublisherName: to.Ptr("autorestsdk"), - }, - SKU: &armapimanagement.ServiceSKUProperties{ - Name: to.Ptr(armapimanagement.SKUTypePremium), - Capacity: to.Ptr[int32](2), - }, - Zones: []*string{ - to.Ptr("1"), - to.Ptr("2")}, - }, 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // "tag3": to.Ptr("value3"), - // }, - // Etag: to.Ptr("AAAAAAAiXvE="), - // Location: to.Ptr("North Europe"), - // Properties: &armapimanagement.ServiceProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-07-28T23:18:14.6562474Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DeveloperPortalURL: to.Ptr("https://apimService1.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimService1-northeurope-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PlatformVersion: to.Ptr(armapimanagement.PlatformVersionStv2), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("20.54.34.66")}, - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("apim@autorestsdk.com"), - // PublisherName: to.Ptr("autorestsdk"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](2), - // }, - // SystemData: &armapimanagement.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armapimanagement.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeApplication), - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceWithCustomHostnameKeyVault.json -func ExampleServiceClient_BeginCreateOrUpdate_apiManagementCreateServiceWithCustomHostnameKeyVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.ServiceResource{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - "tag3": to.Ptr("value3"), - }, - Identity: &armapimanagement.ServiceIdentity{ - Type: to.Ptr(armapimanagement.ApimIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armapimanagement.UserIdentityProperties{ - "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}, - }, - }, - Location: to.Ptr("North Europe"), - Properties: &armapimanagement.ServiceProperties{ - APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - MinAPIVersion: to.Ptr("2019-01-01"), - }, - HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - { - Type: to.Ptr(armapimanagement.HostnameTypeProxy), - DefaultSSLBinding: to.Ptr(true), - HostName: to.Ptr("gateway1.msitesting.net"), - IdentityClientID: to.Ptr("329419bc-adec-4dce-9568-25a6d486e468"), - KeyVaultID: to.Ptr("https://rpbvtkeyvaultintegration.vault.azure.net/secrets/msitestingCert"), - }, - { - Type: to.Ptr(armapimanagement.HostnameTypeManagement), - HostName: to.Ptr("mgmt.msitesting.net"), - IdentityClientID: to.Ptr("329419bc-adec-4dce-9568-25a6d486e468"), - KeyVaultID: to.Ptr("https://rpbvtkeyvaultintegration.vault.azure.net/secrets/msitestingCert"), - }, - { - Type: to.Ptr(armapimanagement.HostnameTypePortal), - HostName: to.Ptr("portal1.msitesting.net"), - IdentityClientID: to.Ptr("329419bc-adec-4dce-9568-25a6d486e468"), - KeyVaultID: to.Ptr("https://rpbvtkeyvaultintegration.vault.azure.net/secrets/msitestingCert"), - }}, - VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - PublisherEmail: to.Ptr("apim@autorestsdk.com"), - PublisherName: to.Ptr("autorestsdk"), - }, - SKU: &armapimanagement.ServiceSKUProperties{ - Name: to.Ptr(armapimanagement.SKUTypePremium), - Capacity: to.Ptr[int32](1), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // "tag3": to.Ptr("value3"), - // }, - // Etag: to.Ptr("AAAAAAAigjU="), - // Identity: &armapimanagement.ServiceIdentity{ - // Type: to.Ptr(armapimanagement.ApimIdentityTypeUserAssigned), - // TenantID: to.Ptr("f686d426-8d16-xxxx-xxxx-ab578e110ccd"), - // UserAssignedIdentities: map[string]*armapimanagement.UserIdentityProperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armapimanagement.UserIdentityProperties{ - // ClientID: to.Ptr("329419bc-adec-4dce-9568-25a6d486e468"), - // PrincipalID: to.Ptr("15e769b2-xxxx-xxxx-xxxx-3fd9a923ac3a"), - // }, - // }, - // }, - // Location: to.Ptr("North Europe"), - // Properties: &armapimanagement.ServiceProperties{ - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // MinAPIVersion: to.Ptr("2019-01-01"), - // }, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-13T22:30:20.7759747Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DeveloperPortalURL: to.Ptr("https://apimService1.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimService1-northeurope-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2037-01-01T07:00:00+00:00"); return t}()), - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("EA276907917CB5XXXXXXXXXXX690"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceKeyVault), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("gateway1.msitesting.net"), - // IdentityClientID: to.Ptr("329419bc-adec-4dce-9568-25a6d486e468"), - // KeyVaultID: to.Ptr("https://rpbvtkeyvaultintegration.vault.azure.net/secrets/msitestingCert"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeManagement), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2037-01-01T07:00:00+00:00"); return t}()), - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("EA276907917CB5XXXXXXXXXXX690"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceKeyVault), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("mgmt.msitesting.net"), - // IdentityClientID: to.Ptr("329419bc-adec-4dce-9568-25a6d486e468"), - // KeyVaultID: to.Ptr("https://rpbvtkeyvaultintegration.vault.azure.net/secrets/msitestingCert"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypePortal), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2037-01-01T07:00:00+00:00"); return t}()), - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("EA276907917CB5XXXXXXXXXXX690"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceKeyVault), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("portal1.msitesting.net"), - // IdentityClientID: to.Ptr("329419bc-adec-4dce-9568-25a6d486e468"), - // KeyVaultID: to.Ptr("https://rpbvtkeyvaultintegration.vault.azure.net/secrets/msitestingCert"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PlatformVersion: to.Ptr(armapimanagement.PlatformVersionStv2), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("40.112.74.192")}, - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("apim@autorestsdk.com"), - // PublisherName: to.Ptr("autorestsdk"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // SystemData: &armapimanagement.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armapimanagement.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeApplication), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceWithSystemCertificates.json -func ExampleServiceClient_BeginCreateOrUpdate_apiManagementCreateServiceWithSystemCertificates() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.ServiceResource{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - "tag3": to.Ptr("value3"), - }, - Location: to.Ptr("Central US"), - Properties: &armapimanagement.ServiceProperties{ - Certificates: []*armapimanagement.CertificateConfiguration{ - { - CertificatePassword: to.Ptr("Password"), - EncodedCertificate: to.Ptr("*******Base64 encoded Certificate******************"), - StoreName: to.Ptr(armapimanagement.CertificateConfigurationStoreNameCertificateAuthority), - }}, - PublisherEmail: to.Ptr("apim@autorestsdk.com"), - PublisherName: to.Ptr("autorestsdk"), - }, - SKU: &armapimanagement.ServiceSKUProperties{ - Name: to.Ptr(armapimanagement.SKUTypeBasic), - Capacity: to.Ptr[int32](1), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // "tag3": to.Ptr("value3"), - // }, - // Etag: to.Ptr("AAAAAAAp3UM="), - // Location: to.Ptr("Central US"), - // Properties: &armapimanagement.ServiceProperties{ - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // }, - // Certificates: []*armapimanagement.CertificateConfiguration{ - // { - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2036-01-01T07:00:00+00:00"); return t}()), - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("8E989652CABCF585ACBFCB9C2C91F1D174FDB3A2"), - // }, - // StoreName: to.Ptr(armapimanagement.CertificateConfigurationStoreNameCertificateAuthority), - // }}, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-18T06:33:28.0906918Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DeveloperPortalURL: to.Ptr("https://apimService1.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimService1-centralus-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PlatformVersion: to.Ptr(armapimanagement.PlatformVersionStv2), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("40.113.223.117")}, - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("apim@autorestsdk.com"), - // PublisherName: to.Ptr("autorestsdk"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypeBasic), - // Capacity: to.Ptr[int32](1), - // }, - // SystemData: &armapimanagement.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armapimanagement.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeApplication), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceWithUserAssignedIdentity.json -func ExampleServiceClient_BeginCreateOrUpdate_apiManagementCreateServiceWithUserAssignedIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.ServiceResource{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - "tag3": to.Ptr("value3"), - }, - Identity: &armapimanagement.ServiceIdentity{ - Type: to.Ptr(armapimanagement.ApimIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armapimanagement.UserIdentityProperties{ - "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/apimService1": {}, - }, - }, - Location: to.Ptr("West US"), - Properties: &armapimanagement.ServiceProperties{ - PublisherEmail: to.Ptr("apim@autorestsdk.com"), - PublisherName: to.Ptr("autorestsdk"), - }, - SKU: &armapimanagement.ServiceSKUProperties{ - Name: to.Ptr(armapimanagement.SKUTypeConsumption), - Capacity: to.Ptr[int32](0), - }, - }, 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // "tag3": to.Ptr("value3"), - // }, - // Etag: to.Ptr("AAAAAAAFzyk="), - // Identity: &armapimanagement.ServiceIdentity{ - // Type: to.Ptr(armapimanagement.ApimIdentityTypeUserAssigned), - // TenantID: to.Ptr("XXXXX-86f1-41af-XXXX-2d7cd011db47"), - // UserAssignedIdentities: map[string]*armapimanagement.UserIdentityProperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/apimService1": &armapimanagement.UserIdentityProperties{ - // ClientID: to.Ptr("5a2c6b8e-0905-XXXX-a772-993c9418137f"), - // PrincipalID: to.Ptr("XXXXX-6e62-4649-9f54-a119fc1ba85e"), - // }, - // }, - // }, - // Location: to.Ptr("West US"), - // Properties: &armapimanagement.ServiceProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T01:05:33.4573398Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DisableGateway: to.Ptr(false), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PlatformVersion: to.Ptr(armapimanagement.PlatformVersionMtv1), - // ProvisioningState: to.Ptr("Succeeded"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("apim@autorestsdk.com"), - // PublisherName: to.Ptr("autorestsdk"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypeConsumption), - // Capacity: to.Ptr[int32](0), - // }, - // SystemData: &armapimanagement.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armapimanagement.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeApplication), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUndelete.json -func ExampleServiceClient_BeginCreateOrUpdate_apiManagementUndelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.ServiceResource{ - Location: to.Ptr("South Central US"), - Properties: &armapimanagement.ServiceProperties{ - Restore: to.Ptr(true), - PublisherEmail: to.Ptr("foo@contoso.com"), - PublisherName: to.Ptr("foo"), - }, - SKU: &armapimanagement.ServiceSKUProperties{ - Name: to.Ptr(armapimanagement.SKUTypeDeveloper), - Capacity: to.Ptr[int32](1), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Etag: to.Ptr("AAAAAAAp3T4="), - // Location: to.Ptr("South Central US"), - // Properties: &armapimanagement.ServiceProperties{ - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // }, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-18T06:10:56.0327105Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DeveloperPortalURL: to.Ptr("https://apimService1.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimService1-southcentralus-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("23.102.171.124")}, - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("foo@contoso.com"), - // PublisherName: to.Ptr("foo"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypeDeveloper), - // Capacity: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateServiceDisableTls10.json -func ExampleServiceClient_BeginUpdate_apiManagementUpdateServiceDisableTls10() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginUpdate(ctx, "rg1", "apimService1", armapimanagement.ServiceUpdateParameters{ - Properties: &armapimanagement.ServiceUpdateProperties{ - CustomProperties: map[string]*string{ - "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("false"), - }, - }, - }, 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "Owner": to.Ptr("sasolank"), - // "Pool": to.Ptr("Manual"), - // "Reserved": to.Ptr(""), - // "TestExpiration": to.Ptr("Thu, 29 Jun 2017 18:50:40 GMT"), - // "TestSuiteExpiration": to.Ptr("Thu, 29 Jun 2017 18:51:46 GMT"), - // "UID": to.Ptr("4f5025fe-0669-4e2e-8320-5199466e5eb3"), - // }, - // Etag: to.Ptr("AAAAAAAYRPs="), - // Location: to.Ptr("West US"), - // Properties: &armapimanagement.ServiceProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-29T17:50:42.3191122Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // }, - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // }, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("40.86.176.232")}, - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("admin@live.com"), - // PublisherName: to.Ptr("Contoso"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypeStandard), - // Capacity: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateServicePublisherDetails.json -func ExampleServiceClient_BeginUpdate_apiManagementUpdateServicePublisherDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginUpdate(ctx, "rg1", "apimService1", armapimanagement.ServiceUpdateParameters{ - Properties: &armapimanagement.ServiceUpdateProperties{ - PublisherEmail: to.Ptr("foobar@live.com"), - PublisherName: to.Ptr("Contoso Vnext"), - }, - }, 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "Owner": to.Ptr("sasolank"), - // "Pool": to.Ptr("Manual"), - // "Reserved": to.Ptr(""), - // "TestExpiration": to.Ptr("Thu, 29 Jun 2017 18:50:40 GMT"), - // "TestSuiteExpiration": to.Ptr("Thu, 29 Jun 2017 18:51:46 GMT"), - // "UID": to.Ptr("4f5025fe-0669-4e2e-8320-5199466e5eb3"), - // }, - // Etag: to.Ptr("AAAAAAAYRPs="), - // Location: to.Ptr("West US"), - // Properties: &armapimanagement.ServiceProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-29T17:50:42.3191122Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // }, - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // }, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("40.86.176.232")}, - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("foobar@live.com"), - // PublisherName: to.Ptr("Contoso Vnext"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypeStandard), - // Capacity: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateServiceToNewVnetAndAZs.json -func ExampleServiceClient_BeginUpdate_apiManagementUpdateServiceToNewVnetAndAvailabilityZones() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginUpdate(ctx, "rg1", "apimService1", armapimanagement.ServiceUpdateParameters{ - Properties: &armapimanagement.ServiceUpdateProperties{ - AdditionalLocations: []*armapimanagement.AdditionalLocation{ - { - Location: to.Ptr("Australia East"), - PublicIPAddressID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/apim-australia-east-publicip"), - SKU: &armapimanagement.ServiceSKUProperties{ - Name: to.Ptr(armapimanagement.SKUTypePremium), - Capacity: to.Ptr[int32](3), - }, - VirtualNetworkConfiguration: &armapimanagement.VirtualNetworkConfiguration{ - SubnetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/apimaeavnet/subnets/default"), - }, - Zones: []*string{ - to.Ptr("1"), - to.Ptr("2"), - to.Ptr("3")}, - }}, - PublicIPAddressID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/publicip-apim-japan-east"), - VirtualNetworkConfiguration: &armapimanagement.VirtualNetworkConfiguration{ - SubnetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-apim-japaneast/subnets/apim2"), - }, - VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeExternal), - }, - SKU: &armapimanagement.ServiceSKUProperties{ - Name: to.Ptr(armapimanagement.SKUTypePremium), - Capacity: to.Ptr[int32](3), - }, - Zones: []*string{ - to.Ptr("1"), - to.Ptr("2"), - to.Ptr("3")}, - }, 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Etag: to.Ptr("AAAAAAAWBIU="), - // Location: to.Ptr("Japan East"), - // Properties: &armapimanagement.ServiceProperties{ - // AdditionalLocations: []*armapimanagement.AdditionalLocation{ - // { - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimService1-australiaeast-01.regional.azure-api.net"), - // Location: to.Ptr("Australia East"), - // PlatformVersion: to.Ptr(armapimanagement.PlatformVersionStv2), - // PublicIPAddresses: []*string{ - // to.Ptr("20.213.1.35")}, - // PublicIPAddressID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/apim-australia-east-publicip"), - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](3), - // }, - // VirtualNetworkConfiguration: &armapimanagement.VirtualNetworkConfiguration{ - // SubnetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/apimaeavnet/subnets/default"), - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }}, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-08T23:41:35.6447381Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_GCM_SHA256": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_256_CBC_SHA": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_256_CBC_SHA256": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("false"), - // }, - // DeveloperPortalURL: to.Ptr("https://apimService1.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimService1-japaneast-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-06-09T23:59:59+00:00"); return t}()), - // Subject: to.Ptr("CN=mycustomdomain.int-azure-api.net"), - // Thumbprint: to.Ptr("2994B5FFB8F76B3C687D324A8DEE0432C1ED18CD"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceManaged), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("mycustomdomain.int-azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PlatformVersion: to.Ptr(armapimanagement.PlatformVersionStv2), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("20.78.248.217")}, - // PublicIPAddressID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/publicip-apim-japan-east"), - // PublicNetworkAccess: to.Ptr(armapimanagement.PublicNetworkAccessEnabled), - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkConfiguration: &armapimanagement.VirtualNetworkConfiguration{ - // SubnetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-apim-japaneast/subnets/apim2"), - // }, - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeInternal), - // PublisherEmail: to.Ptr("contoso@microsoft.com"), - // PublisherName: to.Ptr("apimPublisher"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](3), - // }, - // SystemData: &armapimanagement.SystemData{ - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-21T20:04:21.6108974Z"); return t}()), - // LastModifiedBy: to.Ptr("contoso@microsoft.com"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetMultiRegionInternalVnet.json -func ExampleServiceClient_Get_apiManagementServiceGetMultiRegionInternalVnet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceClient().Get(ctx, "rg1", "apimService1", 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimservice1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimservice1"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAADqC0c="), - // Location: to.Ptr("West US"), - // Properties: &armapimanagement.ServiceProperties{ - // AdditionalLocations: []*armapimanagement.AdditionalLocation{ - // { - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimservice1-westus2-01.regional.azure-api.net"), - // Location: to.Ptr("West US 2"), - // PrivateIPAddresses: []*string{ - // to.Ptr("10.0.X.6")}, - // PublicIPAddresses: []*string{ - // to.Ptr("40.XXX.79.187")}, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // VirtualNetworkConfiguration: &armapimanagement.VirtualNetworkConfiguration{ - // SubnetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/APIMVNet/subnets/apim-internal-sub"), - // }, - // }}, - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // }, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-02T01:42:09.1268424Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("True"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("True"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("True"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("True"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("True"), - // }, - // DeveloperPortalURL: to.Ptr("https://apimService1.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimservice1-westus-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://apimservice1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-16T16:51:34+00:00"); return t}()), - // Subject: to.Ptr("CN=*.preview.net"), - // Thumbprint: to.Ptr("B4330123DBAXXXXXXXXX1F35E84493476"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceCustom), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("apimgatewaytest.preview.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://apimservice1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://apimservice1.portal.azure-api.net"), - // PrivateIPAddresses: []*string{ - // to.Ptr("172.XX.0.5")}, - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("137.XXX.11.74")}, - // ScmURL: to.Ptr("https://apimservice1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkConfiguration: &armapimanagement.VirtualNetworkConfiguration{ - // SubnetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/apim-appGateway-vnet/subnets/apim-subnet"), - // }, - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeInternal), - // PublisherEmail: to.Ptr("abcs@contoso.com"), - // PublisherName: to.Ptr("contoso publisher"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetService.json -func ExampleServiceClient_Get_apiManagementServiceGetService() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceClient().Get(ctx, "rg1", "apimService1", 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("OGF-Z3-06162021-Premium"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/OGF-Z3-06162021-Premium"), - // Tags: map[string]*string{ - // "ReleaseName": to.Ptr("Z3"), - // "owner": to.Ptr("v-aswmoh"), - // }, - // Etag: to.Ptr("AAAAAAAWN/4="), - // Identity: &armapimanagement.ServiceIdentity{ - // Type: to.Ptr(armapimanagement.ApimIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("306205e7-b21a-41bf-92e2-3e28af30041e"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // UserAssignedIdentities: map[string]*armapimanagement.UserIdentityProperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ogf-identity": &armapimanagement.UserIdentityProperties{ - // ClientID: to.Ptr("8d9791f2-0cdf-41f4-9e66-cdc39b496789"), - // PrincipalID: to.Ptr("713784d2-ee37-412a-95f0-3768f397f82d"), - // }, - // }, - // }, - // Location: to.Ptr("East US"), - // Properties: &armapimanagement.ServiceProperties{ - // AdditionalLocations: []*armapimanagement.AdditionalLocation{ - // { - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://ogf-z3-06162021-premium-eastus2-01.regional.azure-api.net"), - // Location: to.Ptr("East US 2"), - // PlatformVersion: to.Ptr(armapimanagement.PlatformVersionStv2), - // PublicIPAddresses: []*string{ - // to.Ptr("40.70.24.106")}, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // Zones: []*string{ - // }, - // }}, - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // MinAPIVersion: to.Ptr("2019-12-01"), - // }, - // Certificates: []*armapimanagement.CertificateConfiguration{ - // }, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T09:40:00.9453556Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("false"), - // }, - // DeveloperPortalURL: to.Ptr("https://ogf-z3-06162021-premium.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://ogf-z3-06162021-premium-eastus-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://ogf-z3-06162021-premium.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("ogf-z3-06162021-premium.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-08T22:32:32+00:00"); return t}()), - // Subject: to.Ptr("CN=*.current.int-azure-api.net, O=Microsoft Corporation, L=Redmond, S=WA, C=US"), - // Thumbprint: to.Ptr("BA0C286XXXXXXXX58A4A507E3DBD51"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceCustom), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("gateway.current.int-azure-api.net"), - // KeyVaultID: to.Ptr("https://ogf-testing.vault.azure.net/secrets/current-ssl"), - // NegotiateClientCertificate: to.Ptr(true), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeDeveloperPortal), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-08T22:32:32+00:00"); return t}()), - // Subject: to.Ptr("CN=*.current.int-azure-api.net, O=Microsoft Corporation, L=Redmond, S=WA, C=US"), - // Thumbprint: to.Ptr("BA0C286XXXXXXXX58A4A507E3DBD51"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceCustom), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("developer.current.int-azure-api.net"), - // KeyVaultID: to.Ptr("https://ogf-testing.vault.azure.net/secrets/current-ssl"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeManagement), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-08T22:32:32+00:00"); return t}()), - // Subject: to.Ptr("CN=*.current.int-azure-api.net, O=Microsoft Corporation, L=Redmond, S=WA, C=US"), - // Thumbprint: to.Ptr("BA0C286XXXXXXXX58A4A507E3DBD51"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceCustom), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("mgmt.current.int-azure-api.net"), - // KeyVaultID: to.Ptr("https://ogf-testing.vault.azure.net/secrets/current-ssl"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://ogf-z3-06162021-premium.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PlatformVersion: to.Ptr(armapimanagement.PlatformVersionStv2), - // PortalURL: to.Ptr("https://ogf-z3-06162021-premium.portal.azure-api.net"), - // PrivateEndpointConnections: []*armapimanagement.RemotePrivateEndpointConnectionWrapper{ - // { - // Name: to.Ptr("privateEndpointProxyName"), - // Type: to.Ptr("Microsoft.ApiManagement/service/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/privateEndpointProxyName"), - // Properties: &armapimanagement.PrivateEndpointConnectionWrapperProperties{ - // GroupIDs: []*string{ - // to.Ptr("Gateway")}, - // PrivateEndpoint: &armapimanagement.ArmIDWrapper{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/privateEndpointName"), - // }, - // PrivateLinkServiceConnectionState: &armapimanagement.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my request, thanks"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armapimanagement.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("13.92.130.49")}, - // PublicNetworkAccess: to.Ptr(armapimanagement.PublicNetworkAccessEnabled), - // ScmURL: to.Ptr("https://ogf-z3-06162021-premium.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("string"), - // PublisherName: to.Ptr("Test Premium"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // SystemData: &armapimanagement.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T09:40:00.7106733Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-20T06:33:09.6159006Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetServiceHavingMsi.json -func ExampleServiceClient_Get_apiManagementServiceGetServiceHavingMsi() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceClient().Get(ctx, "rg1", "apimService1", 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAAENfI="), - // Identity: &armapimanagement.ServiceIdentity{ - // Type: to.Ptr(armapimanagement.ApimIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("ca1d33f7-xxxx-42ec-xxxx-d526a1ee953a"), - // TenantID: to.Ptr("72f988bf-xxxx-41af-xxxx-2d7cd011db47"), - // UserAssignedIdentities: map[string]*armapimanagement.UserIdentityProperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/apimService1": &armapimanagement.UserIdentityProperties{ - // ClientID: to.Ptr("aaff9c7d-xxxx-4db2-xxxx-ab0e3e7806cf"), - // PrincipalID: to.Ptr("95194df2-9208-xxxx-xxxx-a10d2af9b5a3"), - // }, - // }, - // }, - // Location: to.Ptr("West Europe"), - // Properties: &armapimanagement.ServiceProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-04-12T00:20:15.6018952Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("True"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("True"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("True"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("True"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("True"), - // }, - // DeveloperPortalURL: to.Ptr("https://apimService1.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://apimService1-westeurope-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("apimService1.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-18T11:11:47+00:00"); return t}()), - // Subject: to.Ptr("CN=*.msitesting.net"), - // Thumbprint: to.Ptr("9833D531D7A45XXXXXA85908BD3692E0BD3F"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceKeyVault), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("proxy.msitesting.net"), - // KeyVaultID: to.Ptr("https://samir-msi-keyvault.vault.azure.net/secrets/msicertificate"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("13.94.xxx.188")}, - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkConfiguration: &armapimanagement.VirtualNetworkConfiguration{ - // SubnetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/dfVirtualNetwork/subnets/backendSubnet"), - // }, - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeExternal), - // PublisherEmail: to.Ptr("foo@contoso.com"), - // PublisherName: to.Ptr("Contoso"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceDeleteService.json -func ExampleServiceClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginDelete(ctx, "rg1", "apimService1", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListServiceBySubscriptionAndResourceGroup.json -func ExampleServiceClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServiceClient().NewListByResourceGroupPager("rg1", 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.ServiceListResult = armapimanagement.ServiceListResult{ - // Value: []*armapimanagement.ServiceResource{ - // { - // Name: to.Ptr("OGF-Z3-06162021-Premium"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/OGF-Z3-06162021-Premium"), - // Tags: map[string]*string{ - // "ReleaseName": to.Ptr("Z3"), - // "owner": to.Ptr("v-aswmoh"), - // }, - // Etag: to.Ptr("AAAAAAAWN/4="), - // Identity: &armapimanagement.ServiceIdentity{ - // Type: to.Ptr(armapimanagement.ApimIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("306205e7-b21a-41bf-92e2-3e28af30041e"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // UserAssignedIdentities: map[string]*armapimanagement.UserIdentityProperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ogf-identity": &armapimanagement.UserIdentityProperties{ - // ClientID: to.Ptr("8d9791f2-0cdf-41f4-9e66-cdc39b496789"), - // PrincipalID: to.Ptr("713784d2-ee37-412a-95f0-3768f397f82d"), - // }, - // }, - // }, - // Location: to.Ptr("East US"), - // Properties: &armapimanagement.ServiceProperties{ - // AdditionalLocations: []*armapimanagement.AdditionalLocation{ - // { - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://ogf-z3-06162021-premium-eastus2-01.regional.azure-api.net"), - // Location: to.Ptr("East US 2"), - // PublicIPAddresses: []*string{ - // to.Ptr("40.70.24.106")}, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // Zones: []*string{ - // }, - // }}, - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // MinAPIVersion: to.Ptr("2019-12-01"), - // }, - // Certificates: []*armapimanagement.CertificateConfiguration{ - // }, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T09:40:00.9453556Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("false"), - // }, - // DeveloperPortalURL: to.Ptr("https://ogf-z3-06162021-premium.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://ogf-z3-06162021-premium-eastus-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://ogf-z3-06162021-premium.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("ogf-z3-06162021-premium.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-08T22:32:32+00:00"); return t}()), - // Subject: to.Ptr("CN=*.current.int-azure-api.net, O=Microsoft Corporation, L=Redmond, S=WA, C=US"), - // Thumbprint: to.Ptr("BA0C286F71AF3B6A01BDB240C58A4A507E3DBD51"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceCustom), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("gateway.current.int-azure-api.net"), - // KeyVaultID: to.Ptr("https://ogf-testing.vault-int.azure-int.net/secrets/current-ssl"), - // NegotiateClientCertificate: to.Ptr(true), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeDeveloperPortal), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-08T22:32:32+00:00"); return t}()), - // Subject: to.Ptr("CN=*.current.int-azure-api.net, O=Microsoft Corporation, L=Redmond, S=WA, C=US"), - // Thumbprint: to.Ptr("BA0C286F71AF3B6A01BDB240C58A4A507E3DBD51"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceCustom), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("developer.current.int-azure-api.net"), - // KeyVaultID: to.Ptr("https://ogf-testing.vault-int.azure-int.net/secrets/current-ssl"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeManagement), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-08T22:32:32+00:00"); return t}()), - // Subject: to.Ptr("CN=*.current.int-azure-api.net, O=Microsoft Corporation, L=Redmond, S=WA, C=US"), - // Thumbprint: to.Ptr("BA0C286F71AF3B6A01BDB240C58A4A507E3DBD51"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceCustom), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("mgmt.current.int-azure-api.net"), - // KeyVaultID: to.Ptr("https://ogf-testing.vault-int.azure-int.net/secrets/current-ssl"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://ogf-z3-06162021-premium.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://ogf-z3-06162021-premium.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("13.92.130.49")}, - // PublicNetworkAccess: to.Ptr(armapimanagement.PublicNetworkAccessEnabled), - // ScmURL: to.Ptr("https://ogf-z3-06162021-premium.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("bar@contoso.com"), - // PublisherName: to.Ptr("Test Premium"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // SystemData: &armapimanagement.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T09:40:00.7106733Z"); return t}()), - // CreatedBy: to.Ptr("bar@contoso.com"), - // CreatedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-20T06:33:09.6159006Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("vvktestcons"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/vvktestcons"), - // Tags: map[string]*string{ - // "Owner": to.Ptr("vitaliik"), - // }, - // Etag: to.Ptr("AAAAAAAWKwo="), - // Location: to.Ptr("East US"), - // Properties: &armapimanagement.ServiceProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-10T18:07:23.4565211Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DisableGateway: to.Ptr(false), - // EnableClientCertificate: to.Ptr(false), - // GatewayURL: to.Ptr("https://vvktestcons.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("vvktestcons.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccess: to.Ptr(armapimanagement.PublicNetworkAccessEnabled), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("bar@contoso.com"), - // PublisherName: to.Ptr("vvktestcons"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypeConsumption), - // Capacity: to.Ptr[int32](0), - // }, - // }, - // { - // Name: to.Ptr("OGF-Z3-06162021-Standard"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/OGF-Z3-06162021-Standard"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAAWF7M="), - // Identity: &armapimanagement.ServiceIdentity{ - // Type: to.Ptr(armapimanagement.ApimIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("347a5800-ca99-475a-9202-fe38ca79ee41"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // UserAssignedIdentities: map[string]*armapimanagement.UserIdentityProperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ogf-identity": &armapimanagement.UserIdentityProperties{ - // ClientID: to.Ptr("8d9791f2-0cdf-41f4-9e66-cdc39b496789"), - // PrincipalID: to.Ptr("713784d2-ee37-412a-95f0-3768f397f82d"), - // }, - // }, - // }, - // Location: to.Ptr("East US"), - // Properties: &armapimanagement.ServiceProperties{ - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // MinAPIVersion: to.Ptr("2019-12-01"), - // }, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T09:39:58.6555759Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA": to.Ptr("true"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DeveloperPortalURL: to.Ptr("https://ogf-z3-06162021-standard.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://ogf-z3-06162021-standard-eastus-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://ogf-z3-06162021-standard.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("ogf-z3-06162021-standard.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://ogf-z3-06162021-standard.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://ogf-z3-06162021-standard.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("13.82.208.32")}, - // PublicNetworkAccess: to.Ptr(armapimanagement.PublicNetworkAccessEnabled), - // ScmURL: to.Ptr("https://ogf-z3-06162021-standard.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("bar@contoso.com"), - // PublisherName: to.Ptr("Test Standard"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypeStandard), - // Capacity: to.Ptr[int32](2), - // }, - // SystemData: &armapimanagement.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T09:39:58.4591834Z"); return t}()), - // CreatedBy: to.Ptr("bar@contoso.com"), - // CreatedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T15:05:13.5494721Z"); return t}()), - // LastModifiedBy: to.Ptr("bar@contoso.com"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("ogf-dev-060921"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/ogf-dev-060921"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAAWEFg="), - // Identity: &armapimanagement.ServiceIdentity{ - // Type: to.Ptr(armapimanagement.ApimIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("c9bd4c05-205e-4431-b232-112cf2e9e0aa"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // }, - // Location: to.Ptr("East US"), - // Properties: &armapimanagement.ServiceProperties{ - // AdditionalLocations: []*armapimanagement.AdditionalLocation{ - // { - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://ogf-dev-060921-southcentralus-01.regional.azure-api.net"), - // Location: to.Ptr("South Central US"), - // PublicIPAddresses: []*string{ - // to.Ptr("13.84.208.29")}, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](9), - // }, - // Zones: []*string{ - // }, - // }}, - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // MinAPIVersion: to.Ptr("2019-12-01"), - // }, - // Certificates: []*armapimanagement.CertificateConfiguration{ - // { - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T22:51:47+00:00"); return t}()), - // Subject: to.Ptr("CN=*.apim.net"), - // Thumbprint: to.Ptr("4E8234312EC69245D1AE296C4882D46FB84076A3"), - // }, - // StoreName: to.Ptr(armapimanagement.CertificateConfigurationStoreNameRoot), - // }}, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T10:06:22.2133978Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("false"), - // }, - // DeveloperPortalURL: to.Ptr("https://ogf-dev-060921.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://ogf-dev-060921-eastus-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://ogf-dev-060921.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("ogf-dev-060921.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://ogf-dev-060921.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://ogf-dev-060921.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("168.62.39.172")}, - // PublicNetworkAccess: to.Ptr(armapimanagement.PublicNetworkAccessEnabled), - // ScmURL: to.Ptr("https://ogf-dev-060921.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("v-ssaiprasan@microsoft.com"), - // PublisherName: to.Ptr("TechM"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](3), - // }, - // SystemData: &armapimanagement.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T10:06:21.7336597Z"); return t}()), - // CreatedBy: to.Ptr("v-ssaiprasan@microsoft.com"), - // CreatedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T14:27:05.546816Z"); return t}()), - // LastModifiedBy: to.Ptr("v-ssaiprasan@microsoft.com"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListServiceBySubscription.json -func ExampleServiceClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServiceClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServiceListResult = armapimanagement.ServiceListResult{ - // Value: []*armapimanagement.ServiceResource{ - // { - // Name: to.Ptr("OGF-Z3-06162021-Premium"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/OGF-Z3-06162021-Premium"), - // Tags: map[string]*string{ - // "ReleaseName": to.Ptr("Z3"), - // "owner": to.Ptr("v-aswmoh"), - // }, - // Etag: to.Ptr("AAAAAAAWN/4="), - // Identity: &armapimanagement.ServiceIdentity{ - // Type: to.Ptr(armapimanagement.ApimIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("306205e7-b21a-41bf-92e2-3e28af30041e"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // UserAssignedIdentities: map[string]*armapimanagement.UserIdentityProperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ogf-identity": &armapimanagement.UserIdentityProperties{ - // ClientID: to.Ptr("8d9791f2-0cdf-41f4-9e66-cdc39b496789"), - // PrincipalID: to.Ptr("713784d2-ee37-412a-95f0-3768f397f82d"), - // }, - // }, - // }, - // Location: to.Ptr("East US"), - // Properties: &armapimanagement.ServiceProperties{ - // AdditionalLocations: []*armapimanagement.AdditionalLocation{ - // { - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://ogf-z3-06162021-premium-eastus2-01.regional.azure-api.net"), - // Location: to.Ptr("East US 2"), - // PublicIPAddresses: []*string{ - // to.Ptr("40.70.24.106")}, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // Zones: []*string{ - // }, - // }}, - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // MinAPIVersion: to.Ptr("2019-12-01"), - // }, - // Certificates: []*armapimanagement.CertificateConfiguration{ - // }, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T09:40:00.9453556Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("false"), - // }, - // DeveloperPortalURL: to.Ptr("https://ogf-z3-06162021-premium.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://ogf-z3-06162021-premium-eastus-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://ogf-z3-06162021-premium.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("ogf-z3-06162021-premium.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-08T22:32:32+00:00"); return t}()), - // Subject: to.Ptr("CN=*.current.int-azure-api.net, O=Microsoft Corporation, L=Redmond, S=WA, C=US"), - // Thumbprint: to.Ptr("BA0C286F71AF3B6A01BDB240C58A4A507E3DBD51"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceCustom), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("gateway.current.int-azure-api.net"), - // KeyVaultID: to.Ptr("https://ogf-testing.vault-int.azure-int.net/secrets/current-ssl"), - // NegotiateClientCertificate: to.Ptr(true), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeDeveloperPortal), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-08T22:32:32+00:00"); return t}()), - // Subject: to.Ptr("CN=*.current.int-azure-api.net, O=Microsoft Corporation, L=Redmond, S=WA, C=US"), - // Thumbprint: to.Ptr("BA0C286F71AF3B6A01BDB240C58A4A507E3DBD51"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceCustom), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("developer.current.int-azure-api.net"), - // KeyVaultID: to.Ptr("https://ogf-testing.vault-int.azure-int.net/secrets/current-ssl"), - // NegotiateClientCertificate: to.Ptr(false), - // }, - // { - // Type: to.Ptr(armapimanagement.HostnameTypeManagement), - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-08T22:32:32+00:00"); return t}()), - // Subject: to.Ptr("CN=*.current.int-azure-api.net, O=Microsoft Corporation, L=Redmond, S=WA, C=US"), - // Thumbprint: to.Ptr("BA0C286F71AF3B6A01BDB240C58A4A507E3DBD51"), - // }, - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceCustom), - // DefaultSSLBinding: to.Ptr(false), - // HostName: to.Ptr("mgmt.current.int-azure-api.net"), - // KeyVaultID: to.Ptr("https://ogf-testing.vault-int.azure-int.net/secrets/current-ssl"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://ogf-z3-06162021-premium.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://ogf-z3-06162021-premium.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("13.92.130.49")}, - // PublicNetworkAccess: to.Ptr(armapimanagement.PublicNetworkAccessEnabled), - // ScmURL: to.Ptr("https://ogf-z3-06162021-premium.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("bar@contoso.com"), - // PublisherName: to.Ptr("Test Premium"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // SystemData: &armapimanagement.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T09:40:00.7106733Z"); return t}()), - // CreatedBy: to.Ptr("bar@contoso.com"), - // CreatedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-20T06:33:09.6159006Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("vvktestcons"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/vvktestcons"), - // Tags: map[string]*string{ - // "Owner": to.Ptr("vitaliik"), - // }, - // Etag: to.Ptr("AAAAAAAWKwo="), - // Location: to.Ptr("East US"), - // Properties: &armapimanagement.ServiceProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-10T18:07:23.4565211Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DisableGateway: to.Ptr(false), - // EnableClientCertificate: to.Ptr(false), - // GatewayURL: to.Ptr("https://vvktestcons.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("vvktestcons.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccess: to.Ptr(armapimanagement.PublicNetworkAccessEnabled), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("bar@contoso.com"), - // PublisherName: to.Ptr("vvktestcons"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypeConsumption), - // Capacity: to.Ptr[int32](0), - // }, - // }, - // { - // Name: to.Ptr("OGF-Z3-06162021-Standard"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/OGF-Z3-06162021-Standard"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAAWF7M="), - // Identity: &armapimanagement.ServiceIdentity{ - // Type: to.Ptr(armapimanagement.ApimIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("347a5800-ca99-475a-9202-fe38ca79ee41"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // UserAssignedIdentities: map[string]*armapimanagement.UserIdentityProperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ogf-identity": &armapimanagement.UserIdentityProperties{ - // ClientID: to.Ptr("8d9791f2-0cdf-41f4-9e66-cdc39b496789"), - // PrincipalID: to.Ptr("713784d2-ee37-412a-95f0-3768f397f82d"), - // }, - // }, - // }, - // Location: to.Ptr("East US"), - // Properties: &armapimanagement.ServiceProperties{ - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // MinAPIVersion: to.Ptr("2019-12-01"), - // }, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T09:39:58.6555759Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA": to.Ptr("true"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("False"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("False"), - // }, - // DeveloperPortalURL: to.Ptr("https://ogf-z3-06162021-standard.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://ogf-z3-06162021-standard-eastus-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://ogf-z3-06162021-standard.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("ogf-z3-06162021-standard.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://ogf-z3-06162021-standard.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://ogf-z3-06162021-standard.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("13.82.208.32")}, - // PublicNetworkAccess: to.Ptr(armapimanagement.PublicNetworkAccessEnabled), - // ScmURL: to.Ptr("https://ogf-z3-06162021-standard.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("bar@contoso.com"), - // PublisherName: to.Ptr("Test Standard"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypeStandard), - // Capacity: to.Ptr[int32](2), - // }, - // SystemData: &armapimanagement.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T09:39:58.4591834Z"); return t}()), - // CreatedBy: to.Ptr("bar@contoso.com"), - // CreatedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T15:05:13.5494721Z"); return t}()), - // LastModifiedBy: to.Ptr("bar@contoso.com"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("ogf-dev-060921"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/ogf-dev-060921"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAAWEFg="), - // Identity: &armapimanagement.ServiceIdentity{ - // Type: to.Ptr(armapimanagement.ApimIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("c9bd4c05-205e-4431-b232-112cf2e9e0aa"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // }, - // Location: to.Ptr("East US"), - // Properties: &armapimanagement.ServiceProperties{ - // AdditionalLocations: []*armapimanagement.AdditionalLocation{ - // { - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://ogf-dev-060921-southcentralus-01.regional.azure-api.net"), - // Location: to.Ptr("South Central US"), - // PublicIPAddresses: []*string{ - // to.Ptr("13.84.208.29")}, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](9), - // }, - // Zones: []*string{ - // }, - // }}, - // APIVersionConstraint: &armapimanagement.APIVersionConstraint{ - // MinAPIVersion: to.Ptr("2019-12-01"), - // }, - // Certificates: []*armapimanagement.CertificateConfiguration{ - // { - // Certificate: &armapimanagement.CertificateInformation{ - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T22:51:47+00:00"); return t}()), - // Subject: to.Ptr("CN=*.apim.net"), - // Thumbprint: to.Ptr("4E8234312EC69245D1AE296C4882D46FB84076A3"), - // }, - // StoreName: to.Ptr(armapimanagement.CertificateConfigurationStoreNameRoot), - // }}, - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T10:06:22.2133978Z"); return t}()), - // CustomProperties: map[string]*string{ - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": to.Ptr("false"), - // "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": to.Ptr("false"), - // }, - // DeveloperPortalURL: to.Ptr("https://ogf-dev-060921.developer.azure-api.net"), - // DisableGateway: to.Ptr(false), - // GatewayRegionalURL: to.Ptr("https://ogf-dev-060921-eastus-01.regional.azure-api.net"), - // GatewayURL: to.Ptr("https://ogf-dev-060921.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // { - // Type: to.Ptr(armapimanagement.HostnameTypeProxy), - // CertificateSource: to.Ptr(armapimanagement.CertificateSourceBuiltIn), - // DefaultSSLBinding: to.Ptr(true), - // HostName: to.Ptr("ogf-dev-060921.azure-api.net"), - // NegotiateClientCertificate: to.Ptr(false), - // }}, - // ManagementAPIURL: to.Ptr("https://ogf-dev-060921.management.azure-api.net"), - // NotificationSenderEmail: to.Ptr("apimgmt-noreply@mail.windowsazure.com"), - // PortalURL: to.Ptr("https://ogf-dev-060921.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("168.62.39.172")}, - // PublicNetworkAccess: to.Ptr(armapimanagement.PublicNetworkAccessEnabled), - // ScmURL: to.Ptr("https://ogf-dev-060921.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeNone), - // PublisherEmail: to.Ptr("v-ssaiprasan@microsoft.com"), - // PublisherName: to.Ptr("TechM"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](3), - // }, - // SystemData: &armapimanagement.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T10:06:21.7336597Z"); return t}()), - // CreatedBy: to.Ptr("v-ssaiprasan@microsoft.com"), - // CreatedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T14:27:05.546816Z"); return t}()), - // LastModifiedBy: to.Ptr("v-ssaiprasan@microsoft.com"), - // LastModifiedByType: to.Ptr(armapimanagement.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetSsoToken.json -func ExampleServiceClient_GetSsoToken() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceClient().GetSsoToken(ctx, "rg1", "apimService1", 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.ServiceGetSsoTokenResult = armapimanagement.ServiceGetSsoTokenResult{ - // RedirectURI: to.Ptr("https://apimService1.portal.azure-api.net:443/signin-sso?token=1%26201705301929%26eIkr3%2fnfaLs1GVJ0OVbzkJjAcwPFkEZAPM8VUXvXPf7cJ6lWsB9oUwsk2zln9x0KLkn21txCPJWWheSPq7SNeA%3d%3d"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceCheckNameAvailability.json -func ExampleServiceClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceClient().CheckNameAvailability(ctx, armapimanagement.ServiceCheckNameAvailabilityParameters{ - Name: to.Ptr("apimService1"), - }, 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.ServiceNameAvailabilityResult = armapimanagement.ServiceNameAvailabilityResult{ - // Message: to.Ptr(""), - // NameAvailable: to.Ptr(true), - // Reason: to.Ptr(armapimanagement.NameAvailabilityReasonValid), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetDomainOwnershipIdentifier.json -func ExampleServiceClient_GetDomainOwnershipIdentifier() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceClient().GetDomainOwnershipIdentifier(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceGetDomainOwnershipIdentifierResult = armapimanagement.ServiceGetDomainOwnershipIdentifierResult{ - // DomainOwnershipIdentifier: to.Ptr("KLE1vdMblVeHECAi4nCe3oNaXXXXvNlLrXt2ev84KM="), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementApplyNetworkConfigurationUpdates.json -func ExampleServiceClient_BeginApplyNetworkConfigurationUpdates() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginApplyNetworkConfigurationUpdates(ctx, "rg1", "apimService1", &armapimanagement.ServiceClientBeginApplyNetworkConfigurationUpdatesOptions{Parameters: &armapimanagement.ServiceApplyNetworkConfigurationParameters{ - Location: to.Ptr("west us"), - }, - }) - 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.ServiceResource = armapimanagement.ServiceResource{ - // Name: to.Ptr("apimService1"), - // Type: to.Ptr("Microsoft.ApiManagement/service"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // Tags: map[string]*string{ - // "UID": to.Ptr("52ed5986-717b-45b4-b17c-3df8db372cff"), - // }, - // Etag: to.Ptr("AAAAAAAXX6Y="), - // Location: to.Ptr("East Asia"), - // Properties: &armapimanagement.ServiceProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-09-22T01:50:34.7921566Z"); return t}()), - // GatewayURL: to.Ptr("https://apimService1.azure-api.net"), - // HostnameConfigurations: []*armapimanagement.HostnameConfiguration{ - // }, - // ManagementAPIURL: to.Ptr("https://apimService1.management.azure-api.net"), - // PortalURL: to.Ptr("https://apimService1.portal.azure-api.net"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicIPAddresses: []*string{ - // to.Ptr("207.46.155.24")}, - // ScmURL: to.Ptr("https://apimService1.scm.azure-api.net"), - // TargetProvisioningState: to.Ptr(""), - // VirtualNetworkConfiguration: &armapimanagement.VirtualNetworkConfiguration{ - // SubnetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/eastUsVirtualNetwork/subnets/apimSubnet"), - // }, - // VirtualNetworkType: to.Ptr(armapimanagement.VirtualNetworkTypeExternal), - // PublisherEmail: to.Ptr("admin@live.com"), - // PublisherName: to.Ptr("Contoso"), - // }, - // SKU: &armapimanagement.ServiceSKUProperties{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // Capacity: to.Ptr[int32](1), - // }, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/serviceskus_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/serviceskus_client.go index 94f4397cd246..86eb4b82ea92 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/serviceskus_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/serviceskus_client.go @@ -29,8 +29,7 @@ type ServiceSKUsClient struct { } // NewServiceSKUsClient creates a new instance of ServiceSKUsClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewServiceSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServiceSKUsClient, error) { @@ -47,8 +46,8 @@ func NewServiceSKUsClient(subscriptionID string, credential azcore.TokenCredenti // NewListAvailableServiceSKUsPager - Gets all available SKU for a given API Management service // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - ServiceSKUsClientListAvailableServiceSKUsOptions contains the optional parameters for the ServiceSKUsClient.NewListAvailableServiceSKUsPager // method. @@ -100,7 +99,7 @@ func (client *ServiceSKUsClient) listAvailableServiceSKUsCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/serviceskus_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/serviceskus_client_example_test.go deleted file mode 100644 index 2bf4a6656e94..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/serviceskus_client_example_test.go +++ /dev/null @@ -1,140 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSKUs-Consumption.json -func ExampleServiceSKUsClient_NewListAvailableServiceSKUsPager_apiManagementListSkUsConsumption() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServiceSKUsClient().NewListAvailableServiceSKUsPager("rg1", "apimService1", 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.ResourceSKUResults = armapimanagement.ResourceSKUResults{ - // Value: []*armapimanagement.ResourceSKUResult{ - // { - // ResourceType: to.Ptr("Microsoft.ApiManagement/service"), - // SKU: &armapimanagement.ResourceSKU{ - // Name: to.Ptr(armapimanagement.SKUTypeConsumption), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSKUs-Dedicated.json -func ExampleServiceSKUsClient_NewListAvailableServiceSKUsPager_apiManagementListSkUsDedicated() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServiceSKUsClient().NewListAvailableServiceSKUsPager("rg1", "apimService1", 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.ResourceSKUResults = armapimanagement.ResourceSKUResults{ - // Value: []*armapimanagement.ResourceSKUResult{ - // { - // Capacity: &armapimanagement.ResourceSKUCapacity{ - // Default: to.Ptr[int32](1), - // Maximum: to.Ptr[int32](1), - // Minimum: to.Ptr[int32](1), - // ScaleType: to.Ptr(armapimanagement.ResourceSKUCapacityScaleTypeNone), - // }, - // ResourceType: to.Ptr("Microsoft.ApiManagement/service"), - // SKU: &armapimanagement.ResourceSKU{ - // Name: to.Ptr(armapimanagement.SKUTypeDeveloper), - // }, - // }, - // { - // Capacity: &armapimanagement.ResourceSKUCapacity{ - // Default: to.Ptr[int32](1), - // Maximum: to.Ptr[int32](2), - // Minimum: to.Ptr[int32](1), - // ScaleType: to.Ptr(armapimanagement.ResourceSKUCapacityScaleTypeManual), - // }, - // ResourceType: to.Ptr("Microsoft.ApiManagement/service"), - // SKU: &armapimanagement.ResourceSKU{ - // Name: to.Ptr(armapimanagement.SKUTypeBasic), - // }, - // }, - // { - // Capacity: &armapimanagement.ResourceSKUCapacity{ - // Default: to.Ptr[int32](1), - // Maximum: to.Ptr[int32](4), - // Minimum: to.Ptr[int32](1), - // ScaleType: to.Ptr(armapimanagement.ResourceSKUCapacityScaleTypeAutomatic), - // }, - // ResourceType: to.Ptr("Microsoft.ApiManagement/service"), - // SKU: &armapimanagement.ResourceSKU{ - // Name: to.Ptr(armapimanagement.SKUTypeStandard), - // }, - // }, - // { - // Capacity: &armapimanagement.ResourceSKUCapacity{ - // Default: to.Ptr[int32](1), - // Maximum: to.Ptr[int32](10), - // Minimum: to.Ptr[int32](1), - // ScaleType: to.Ptr(armapimanagement.ResourceSKUCapacityScaleTypeAutomatic), - // }, - // ResourceType: to.Ptr("Microsoft.ApiManagement/service"), - // SKU: &armapimanagement.ResourceSKU{ - // Name: to.Ptr(armapimanagement.SKUTypePremium), - // }, - // }, - // { - // Capacity: &armapimanagement.ResourceSKUCapacity{ - // Default: to.Ptr[int32](1), - // Maximum: to.Ptr[int32](1), - // Minimum: to.Ptr[int32](1), - // ScaleType: to.Ptr(armapimanagement.ResourceSKUCapacityScaleTypeAutomatic), - // }, - // ResourceType: to.Ptr("Microsoft.ApiManagement/service"), - // SKU: &armapimanagement.ResourceSKU{ - // Name: to.Ptr(armapimanagement.SKUTypeIsolated), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/signinsettings_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/signinsettings_client.go index 0437d061891c..42db80c9e44e 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/signinsettings_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/signinsettings_client.go @@ -29,8 +29,7 @@ type SignInSettingsClient struct { } // NewSignInSettingsClient creates a new instance of SignInSettingsClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSignInSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SignInSettingsClient, error) { @@ -48,8 +47,8 @@ func NewSignInSettingsClient(subscriptionID string, credential azcore.TokenCrede // CreateOrUpdate - Create or Update Sign-In settings. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - parameters - Create or update parameters. // - options - SignInSettingsClientCreateOrUpdateOptions contains the optional parameters for the SignInSettingsClient.CreateOrUpdate @@ -89,7 +88,7 @@ func (client *SignInSettingsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -110,8 +109,8 @@ func (client *SignInSettingsClient) createOrUpdateHandleResponse(resp *http.Resp // Get - Get Sign In Settings for the Portal // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - SignInSettingsClientGetOptions contains the optional parameters for the SignInSettingsClient.Get method. func (client *SignInSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, options *SignInSettingsClientGetOptions) (SignInSettingsClientGetResponse, error) { @@ -149,7 +148,7 @@ func (client *SignInSettingsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -169,8 +168,8 @@ func (client *SignInSettingsClient) getHandleResponse(resp *http.Response) (Sign // GetEntityTag - Gets the entity state (Etag) version of the SignInSettings. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - SignInSettingsClientGetEntityTagOptions contains the optional parameters for the SignInSettingsClient.GetEntityTag // method. @@ -209,7 +208,7 @@ func (client *SignInSettingsClient) getEntityTagCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,8 +227,8 @@ func (client *SignInSettingsClient) getEntityTagHandleResponse(resp *http.Respon // Update - Update Sign-In settings. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or // it should be * for unconditional update. @@ -270,7 +269,7 @@ func (client *SignInSettingsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/signinsettings_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/signinsettings_client_example_test.go deleted file mode 100644 index 04cd12af7ffa..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/signinsettings_client_example_test.go +++ /dev/null @@ -1,117 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadSignInSettings.json -func ExampleSignInSettingsClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSignInSettingsClient().GetEntityTag(ctx, "rg1", "apimService1", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsGetSignIn.json -func ExampleSignInSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSignInSettingsClient().Get(ctx, "rg1", "apimService1", 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.PortalSigninSettings = armapimanagement.PortalSigninSettings{ - // Name: to.Ptr("signin"), - // Type: to.Ptr("Microsoft.ApiManagement/service/portalsettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/portalsettings/signin"), - // Properties: &armapimanagement.PortalSigninSettingProperties{ - // Enabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsUpdateSignIn.json -func ExampleSignInSettingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSignInSettingsClient().Update(ctx, "rg1", "apimService1", "*", armapimanagement.PortalSigninSettings{ - Properties: &armapimanagement.PortalSigninSettingProperties{ - Enabled: to.Ptr(true), - }, - }, 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsPutSignIn.json -func ExampleSignInSettingsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSignInSettingsClient().CreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.PortalSigninSettings{ - Properties: &armapimanagement.PortalSigninSettingProperties{ - Enabled: to.Ptr(true), - }, - }, &armapimanagement.SignInSettingsClientCreateOrUpdateOptions{IfMatch: to.Ptr("*")}) - 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.PortalSigninSettings = armapimanagement.PortalSigninSettings{ - // Name: to.Ptr("signin"), - // Type: to.Ptr("Microsoft.ApiManagement/service/portalsettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/portalsettings/signin"), - // Properties: &armapimanagement.PortalSigninSettingProperties{ - // Enabled: to.Ptr(true), - // }, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/signupsettings_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/signupsettings_client.go index 7829fdecefe9..75cbff3c38d6 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/signupsettings_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/signupsettings_client.go @@ -29,8 +29,7 @@ type SignUpSettingsClient struct { } // NewSignUpSettingsClient creates a new instance of SignUpSettingsClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSignUpSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SignUpSettingsClient, error) { @@ -48,8 +47,8 @@ func NewSignUpSettingsClient(subscriptionID string, credential azcore.TokenCrede // CreateOrUpdate - Create or Update Sign-Up settings. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - parameters - Create or update parameters. // - options - SignUpSettingsClientCreateOrUpdateOptions contains the optional parameters for the SignUpSettingsClient.CreateOrUpdate @@ -89,7 +88,7 @@ func (client *SignUpSettingsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -110,8 +109,8 @@ func (client *SignUpSettingsClient) createOrUpdateHandleResponse(resp *http.Resp // Get - Get Sign Up Settings for the Portal // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - SignUpSettingsClientGetOptions contains the optional parameters for the SignUpSettingsClient.Get method. func (client *SignUpSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, options *SignUpSettingsClientGetOptions) (SignUpSettingsClientGetResponse, error) { @@ -149,7 +148,7 @@ func (client *SignUpSettingsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -169,8 +168,8 @@ func (client *SignUpSettingsClient) getHandleResponse(resp *http.Response) (Sign // GetEntityTag - Gets the entity state (Etag) version of the SignUpSettings. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - SignUpSettingsClientGetEntityTagOptions contains the optional parameters for the SignUpSettingsClient.GetEntityTag // method. @@ -209,7 +208,7 @@ func (client *SignUpSettingsClient) getEntityTagCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,8 +227,8 @@ func (client *SignUpSettingsClient) getEntityTagHandleResponse(resp *http.Respon // Update - Update Sign-Up settings. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or // it should be * for unconditional update. @@ -270,7 +269,7 @@ func (client *SignUpSettingsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/signupsettings_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/signupsettings_client_example_test.go deleted file mode 100644 index c11b98ad9bf6..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/signupsettings_client_example_test.go +++ /dev/null @@ -1,137 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadSignUpSettings.json -func ExampleSignUpSettingsClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSignUpSettingsClient().GetEntityTag(ctx, "rg1", "apimService1", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsGetSignUp.json -func ExampleSignUpSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSignUpSettingsClient().Get(ctx, "rg1", "apimService1", 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.PortalSignupSettings = armapimanagement.PortalSignupSettings{ - // Name: to.Ptr("signup"), - // Type: to.Ptr("Microsoft.ApiManagement/service/portalsettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/portalsettings/signup"), - // Properties: &armapimanagement.PortalSignupSettingsProperties{ - // Enabled: to.Ptr(true), - // TermsOfService: &armapimanagement.TermsOfServiceProperties{ - // ConsentRequired: to.Ptr(true), - // Enabled: to.Ptr(true), - // Text: to.Ptr("Terms of service text."), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsUpdateSignUp.json -func ExampleSignUpSettingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSignUpSettingsClient().Update(ctx, "rg1", "apimService1", "*", armapimanagement.PortalSignupSettings{ - Properties: &armapimanagement.PortalSignupSettingsProperties{ - Enabled: to.Ptr(true), - TermsOfService: &armapimanagement.TermsOfServiceProperties{ - ConsentRequired: to.Ptr(true), - Enabled: to.Ptr(true), - Text: to.Ptr("Terms of service text."), - }, - }, - }, 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsPutSignUp.json -func ExampleSignUpSettingsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSignUpSettingsClient().CreateOrUpdate(ctx, "rg1", "apimService1", armapimanagement.PortalSignupSettings{ - Properties: &armapimanagement.PortalSignupSettingsProperties{ - Enabled: to.Ptr(true), - TermsOfService: &armapimanagement.TermsOfServiceProperties{ - ConsentRequired: to.Ptr(true), - Enabled: to.Ptr(true), - Text: to.Ptr("Terms of service text."), - }, - }, - }, &armapimanagement.SignUpSettingsClientCreateOrUpdateOptions{IfMatch: to.Ptr("*")}) - 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.PortalSignupSettings = armapimanagement.PortalSignupSettings{ - // Name: to.Ptr("signup"), - // Type: to.Ptr("Microsoft.ApiManagement/service/portalsettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/portalsettings/signup"), - // Properties: &armapimanagement.PortalSignupSettingsProperties{ - // Enabled: to.Ptr(true), - // TermsOfService: &armapimanagement.TermsOfServiceProperties{ - // ConsentRequired: to.Ptr(true), - // Enabled: to.Ptr(true), - // Text: to.Ptr("Terms of service text."), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/skus_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/skus_client.go index ff7ca81e9312..30d0a39b8d86 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/skus_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/skus_client.go @@ -29,8 +29,7 @@ type SKUsClient struct { } // NewSKUsClient creates a new instance of SKUsClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SKUsClient, error) { @@ -47,7 +46,7 @@ func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, opt // NewListPager - Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview // - options - SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. func (client *SKUsClient) NewListPager(options *SKUsClientListOptions) *runtime.Pager[SKUsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SKUsClientListResponse]{ @@ -89,7 +88,7 @@ func (client *SKUsClient) listCreateRequest(ctx context.Context, options *SKUsCl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/skus_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/skus_client_example_test.go deleted file mode 100644 index ee2475cd838c..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/skus_client_example_test.go +++ /dev/null @@ -1,266 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSku.json -func ExampleSKUsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSKUsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SKUsResult = armapimanagement.SKUsResult{ - // Value: []*armapimanagement.SKU{ - // { - // Name: to.Ptr("Developer"), - // Capacity: &armapimanagement.SKUCapacity{ - // Default: to.Ptr[int32](1), - // Maximum: to.Ptr[int32](1), - // Minimum: to.Ptr[int32](1), - // ScaleType: to.Ptr(armapimanagement.APIManagementSKUCapacityScaleTypeNone), - // }, - // LocationInfo: []*armapimanagement.SKULocationInfo{ - // { - // Location: to.Ptr("centralindia"), - // ZoneDetails: []*armapimanagement.SKUZoneDetails{ - // }, - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("centralindia")}, - // ResourceType: to.Ptr("service"), - // Restrictions: []*armapimanagement.SKURestrictions{ - // }, - // }, - // { - // Name: to.Ptr("Standard"), - // Capacity: &armapimanagement.SKUCapacity{ - // Default: to.Ptr[int32](1), - // Maximum: to.Ptr[int32](4), - // Minimum: to.Ptr[int32](1), - // ScaleType: to.Ptr(armapimanagement.APIManagementSKUCapacityScaleTypeAutomatic), - // }, - // LocationInfo: []*armapimanagement.SKULocationInfo{ - // { - // Location: to.Ptr("centralindia"), - // ZoneDetails: []*armapimanagement.SKUZoneDetails{ - // }, - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("centralindia")}, - // ResourceType: to.Ptr("service"), - // Restrictions: []*armapimanagement.SKURestrictions{ - // }, - // }, - // { - // Name: to.Ptr("Premium"), - // Capacity: &armapimanagement.SKUCapacity{ - // Default: to.Ptr[int32](1), - // Maximum: to.Ptr[int32](10), - // Minimum: to.Ptr[int32](1), - // ScaleType: to.Ptr(armapimanagement.APIManagementSKUCapacityScaleTypeAutomatic), - // }, - // LocationInfo: []*armapimanagement.SKULocationInfo{ - // { - // Location: to.Ptr("centralindia"), - // ZoneDetails: []*armapimanagement.SKUZoneDetails{ - // }, - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("centralindia")}, - // ResourceType: to.Ptr("service"), - // Restrictions: []*armapimanagement.SKURestrictions{ - // }, - // }, - // { - // Name: to.Ptr("Basic"), - // Capacity: &armapimanagement.SKUCapacity{ - // Default: to.Ptr[int32](1), - // Maximum: to.Ptr[int32](2), - // Minimum: to.Ptr[int32](1), - // ScaleType: to.Ptr(armapimanagement.APIManagementSKUCapacityScaleTypeManual), - // }, - // LocationInfo: []*armapimanagement.SKULocationInfo{ - // { - // Location: to.Ptr("centralindia"), - // ZoneDetails: []*armapimanagement.SKUZoneDetails{ - // }, - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("centralindia")}, - // ResourceType: to.Ptr("service"), - // Restrictions: []*armapimanagement.SKURestrictions{ - // }, - // }, - // { - // Name: to.Ptr("Consumption"), - // Capacity: &armapimanagement.SKUCapacity{ - // Default: to.Ptr[int32](0), - // Maximum: to.Ptr[int32](0), - // Minimum: to.Ptr[int32](0), - // ScaleType: to.Ptr(armapimanagement.APIManagementSKUCapacityScaleTypeNone), - // }, - // LocationInfo: []*armapimanagement.SKULocationInfo{ - // { - // Location: to.Ptr("centralindia"), - // ZoneDetails: []*armapimanagement.SKUZoneDetails{ - // }, - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("centralindia")}, - // ResourceType: to.Ptr("service"), - // Restrictions: []*armapimanagement.SKURestrictions{ - // }, - // }, - // { - // Name: to.Ptr("Developer"), - // Capacity: &armapimanagement.SKUCapacity{ - // Default: to.Ptr[int32](1), - // Maximum: to.Ptr[int32](1), - // Minimum: to.Ptr[int32](1), - // ScaleType: to.Ptr(armapimanagement.APIManagementSKUCapacityScaleTypeNone), - // }, - // LocationInfo: []*armapimanagement.SKULocationInfo{ - // { - // Location: to.Ptr("uaenorth"), - // ZoneDetails: []*armapimanagement.SKUZoneDetails{ - // }, - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("uaenorth")}, - // ResourceType: to.Ptr("service"), - // Restrictions: []*armapimanagement.SKURestrictions{ - // }, - // }, - // { - // Name: to.Ptr("Standard"), - // Capacity: &armapimanagement.SKUCapacity{ - // Default: to.Ptr[int32](1), - // Maximum: to.Ptr[int32](4), - // Minimum: to.Ptr[int32](1), - // ScaleType: to.Ptr(armapimanagement.APIManagementSKUCapacityScaleTypeAutomatic), - // }, - // LocationInfo: []*armapimanagement.SKULocationInfo{ - // { - // Location: to.Ptr("uaenorth"), - // ZoneDetails: []*armapimanagement.SKUZoneDetails{ - // }, - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("uaenorth")}, - // ResourceType: to.Ptr("service"), - // Restrictions: []*armapimanagement.SKURestrictions{ - // }, - // }, - // { - // Name: to.Ptr("Premium"), - // Capacity: &armapimanagement.SKUCapacity{ - // Default: to.Ptr[int32](1), - // Maximum: to.Ptr[int32](10), - // Minimum: to.Ptr[int32](1), - // ScaleType: to.Ptr(armapimanagement.APIManagementSKUCapacityScaleTypeAutomatic), - // }, - // LocationInfo: []*armapimanagement.SKULocationInfo{ - // { - // Location: to.Ptr("uaenorth"), - // ZoneDetails: []*armapimanagement.SKUZoneDetails{ - // }, - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("uaenorth")}, - // ResourceType: to.Ptr("service"), - // Restrictions: []*armapimanagement.SKURestrictions{ - // }, - // }, - // { - // Name: to.Ptr("Basic"), - // Capacity: &armapimanagement.SKUCapacity{ - // Default: to.Ptr[int32](1), - // Maximum: to.Ptr[int32](2), - // Minimum: to.Ptr[int32](1), - // ScaleType: to.Ptr(armapimanagement.APIManagementSKUCapacityScaleTypeManual), - // }, - // LocationInfo: []*armapimanagement.SKULocationInfo{ - // { - // Location: to.Ptr("uaenorth"), - // ZoneDetails: []*armapimanagement.SKUZoneDetails{ - // }, - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("uaenorth")}, - // ResourceType: to.Ptr("service"), - // Restrictions: []*armapimanagement.SKURestrictions{ - // }, - // }, - // { - // Name: to.Ptr("Developer"), - // Capacity: &armapimanagement.SKUCapacity{ - // Default: to.Ptr[int32](1), - // Maximum: to.Ptr[int32](1), - // Minimum: to.Ptr[int32](1), - // ScaleType: to.Ptr(armapimanagement.APIManagementSKUCapacityScaleTypeNone), - // }, - // LocationInfo: []*armapimanagement.SKULocationInfo{ - // { - // Location: to.Ptr("australiacentral"), - // ZoneDetails: []*armapimanagement.SKUZoneDetails{ - // }, - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("australiacentral")}, - // ResourceType: to.Ptr("service"), - // Restrictions: []*armapimanagement.SKURestrictions{ - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/subscription_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/subscription_client.go index 5c1dc5ba06bb..53753d7362b6 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/subscription_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/subscription_client.go @@ -30,8 +30,7 @@ type SubscriptionClient struct { } // NewSubscriptionClient creates a new instance of SubscriptionClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSubscriptionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SubscriptionClient, error) { @@ -49,8 +48,8 @@ func NewSubscriptionClient(subscriptionID string, credential azcore.TokenCredent // CreateOrUpdate - Creates or updates the subscription of specified user to the specified product. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. // - parameters - Create parameters. @@ -98,7 +97,7 @@ func (client *SubscriptionClient) createOrUpdateCreateRequest(ctx context.Contex if options != nil && options.Notify != nil { reqQP.Set("notify", strconv.FormatBool(*options.Notify)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") if options != nil && options.AppType != nil { reqQP.Set("appType", string(*options.AppType)) } @@ -125,8 +124,8 @@ func (client *SubscriptionClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Deletes the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -171,7 +170,7 @@ func (client *SubscriptionClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -181,8 +180,8 @@ func (client *SubscriptionClient) deleteCreateRequest(ctx context.Context, resou // Get - Gets the specified Subscription entity. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. // - options - SubscriptionClientGetOptions contains the optional parameters for the SubscriptionClient.Get method. @@ -225,7 +224,7 @@ func (client *SubscriptionClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -245,8 +244,8 @@ func (client *SubscriptionClient) getHandleResponse(resp *http.Response) (Subscr // GetEntityTag - Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. // - options - SubscriptionClientGetEntityTagOptions contains the optional parameters for the SubscriptionClient.GetEntityTag @@ -290,7 +289,7 @@ func (client *SubscriptionClient) getEntityTagCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -308,8 +307,8 @@ func (client *SubscriptionClient) getEntityTagHandleResponse(resp *http.Response // NewListPager - Lists all subscriptions of the API Management service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - SubscriptionClientListOptions contains the optional parameters for the SubscriptionClient.NewListPager method. func (client *SubscriptionClient) NewListPager(resourceGroupName string, serviceName string, options *SubscriptionClientListOptions) *runtime.Pager[SubscriptionClientListResponse] { @@ -369,7 +368,7 @@ func (client *SubscriptionClient) listCreateRequest(ctx context.Context, resourc if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -387,8 +386,8 @@ func (client *SubscriptionClient) listHandleResponse(resp *http.Response) (Subsc // ListSecrets - Gets the specified Subscription keys. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. // - options - SubscriptionClientListSecretsOptions contains the optional parameters for the SubscriptionClient.ListSecrets @@ -432,7 +431,7 @@ func (client *SubscriptionClient) listSecretsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -453,8 +452,8 @@ func (client *SubscriptionClient) listSecretsHandleResponse(resp *http.Response) // RegeneratePrimaryKey - Regenerates primary key of existing subscription of the API Management service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. // - options - SubscriptionClientRegeneratePrimaryKeyOptions contains the optional parameters for the SubscriptionClient.RegeneratePrimaryKey @@ -498,7 +497,7 @@ func (client *SubscriptionClient) regeneratePrimaryKeyCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -507,8 +506,8 @@ func (client *SubscriptionClient) regeneratePrimaryKeyCreateRequest(ctx context. // RegenerateSecondaryKey - Regenerates secondary key of existing subscription of the API Management service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. // - options - SubscriptionClientRegenerateSecondaryKeyOptions contains the optional parameters for the SubscriptionClient.RegenerateSecondaryKey @@ -552,7 +551,7 @@ func (client *SubscriptionClient) regenerateSecondaryKeyCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -561,8 +560,8 @@ func (client *SubscriptionClient) regenerateSecondaryKeyCreateRequest(ctx contex // Update - Updates the details of a subscription specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -611,7 +610,7 @@ func (client *SubscriptionClient) updateCreateRequest(ctx context.Context, resou if options != nil && options.Notify != nil { reqQP.Set("notify", strconv.FormatBool(*options.Notify)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") if options != nil && options.AppType != nil { reqQP.Set("appType", string(*options.AppType)) } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/subscription_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/subscription_client_example_test.go deleted file mode 100644 index 22d8e3c71712..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/subscription_client_example_test.go +++ /dev/null @@ -1,292 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSubscriptions.json -func ExampleSubscriptionClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubscriptionClient().NewListPager("rg1", "apimService1", &armapimanagement.SubscriptionClientListOptions{Filter: nil, - Top: nil, - Skip: 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.SubscriptionCollection = armapimanagement.SubscriptionCollection{ - // Count: to.Ptr[int64](3), - // Value: []*armapimanagement.SubscriptionContract{ - // { - // Name: to.Ptr("5600b59475ff190048070001"), - // Type: to.Ptr("Microsoft.ApiManagement/service/subscriptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/5600b59475ff190048070001"), - // Properties: &armapimanagement.SubscriptionContractProperties{ - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-09-22T01:57:40.3Z"); return t}()), - // OwnerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - // Scope: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060001"), - // State: to.Ptr(armapimanagement.SubscriptionStateActive), - // }, - // }, - // { - // Name: to.Ptr("56eaed3dbaf08b06e46d27fe"), - // Type: to.Ptr("Microsoft.ApiManagement/service/subscriptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/56eaed3dbaf08b06e46d27fe"), - // Properties: &armapimanagement.SubscriptionContractProperties{ - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-03-17T17:45:33.837Z"); return t}()), - // DisplayName: to.Ptr("Starter"), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-04-01T00:00:00Z"); return t}()), - // NotificationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-03-20T00:00:00Z"); return t}()), - // OwnerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/56eaec62baf08b06e46d27fd"), - // Scope: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060001"), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-03-17T00:00:00Z"); return t}()), - // State: to.Ptr(armapimanagement.SubscriptionStateActive), - // }, - // }, - // { - // Name: to.Ptr("5931a769d8d14f0ad8ce13b8"), - // Type: to.Ptr("Microsoft.ApiManagement/service/subscriptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/5931a769d8d14f0ad8ce13b8"), - // Properties: &armapimanagement.SubscriptionContractProperties{ - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T17:59:06.223Z"); return t}()), - // DisplayName: to.Ptr("Unlimited"), - // OwnerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/5931a75ae4bbd512a88c680b"), - // Scope: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002"), - // State: to.Ptr(armapimanagement.SubscriptionStateSubmitted), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadSubscription.json -func ExampleSubscriptionClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSubscriptionClient().GetEntityTag(ctx, "rg1", "apimService1", "5931a769d8d14f0ad8ce13b8", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetSubscription.json -func ExampleSubscriptionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubscriptionClient().Get(ctx, "rg1", "apimService1", "5931a769d8d14f0ad8ce13b8", 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.SubscriptionContract = armapimanagement.SubscriptionContract{ - // Name: to.Ptr("5931a769d8d14f0ad8ce13b8"), - // Type: to.Ptr("Microsoft.ApiManagement/service/subscriptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/5931a769d8d14f0ad8ce13b8"), - // Properties: &armapimanagement.SubscriptionContractProperties{ - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T17:59:06.223Z"); return t}()), - // DisplayName: to.Ptr("Unlimited"), - // OwnerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/5931a75ae4bbd512a88c680b"), - // Scope: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002"), - // State: to.Ptr(armapimanagement.SubscriptionStateSubmitted), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateSubscription.json -func ExampleSubscriptionClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubscriptionClient().CreateOrUpdate(ctx, "rg1", "apimService1", "testsub", armapimanagement.SubscriptionCreateParameters{ - Properties: &armapimanagement.SubscriptionCreateParameterProperties{ - DisplayName: to.Ptr("testsub"), - OwnerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7"), - Scope: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002"), - }, - }, &armapimanagement.SubscriptionClientCreateOrUpdateOptions{Notify: nil, - IfMatch: nil, - AppType: 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.SubscriptionContract = armapimanagement.SubscriptionContract{ - // Name: to.Ptr("testsub"), - // Type: to.Ptr("Microsoft.ApiManagement/service/subscriptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/testsub"), - // Properties: &armapimanagement.SubscriptionContractProperties{ - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T23:34:03.1055076Z"); return t}()), - // DisplayName: to.Ptr("testsub"), - // OwnerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7"), - // Scope: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002"), - // State: to.Ptr(armapimanagement.SubscriptionStateSubmitted), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateSubscription.json -func ExampleSubscriptionClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubscriptionClient().Update(ctx, "rg1", "apimService1", "testsub", "*", armapimanagement.SubscriptionUpdateParameters{ - Properties: &armapimanagement.SubscriptionUpdateParameterProperties{ - DisplayName: to.Ptr("testsub"), - }, - }, &armapimanagement.SubscriptionClientUpdateOptions{Notify: nil, - AppType: 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.SubscriptionContract = armapimanagement.SubscriptionContract{ - // Name: to.Ptr("testsub"), - // Type: to.Ptr("Microsoft.ApiManagement/service/subscriptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/testsub"), - // Properties: &armapimanagement.SubscriptionContractProperties{ - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T17:59:06.223Z"); return t}()), - // DisplayName: to.Ptr("testsub"), - // OwnerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/5931a75ae4bbd512a88c680b"), - // Scope: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002"), - // State: to.Ptr(armapimanagement.SubscriptionStateSubmitted), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteSubscription.json -func ExampleSubscriptionClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSubscriptionClient().Delete(ctx, "rg1", "apimService1", "testsub", "*", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementSubscriptionRegeneratePrimaryKey.json -func ExampleSubscriptionClient_RegeneratePrimaryKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSubscriptionClient().RegeneratePrimaryKey(ctx, "rg1", "apimService1", "testsub", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementSubscriptionRegenerateSecondaryKey.json -func ExampleSubscriptionClient_RegenerateSecondaryKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSubscriptionClient().RegenerateSecondaryKey(ctx, "rg1", "apimService1", "testsub", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementSubscriptionListSecrets.json -func ExampleSubscriptionClient_ListSecrets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubscriptionClient().ListSecrets(ctx, "rg1", "apimService1", "5931a769d8d14f0ad8ce13b8", 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.SubscriptionKeysContract = armapimanagement.SubscriptionKeysContract{ - // PrimaryKey: to.Ptr(""), - // SecondaryKey: to.Ptr(""), - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tag_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/tag_client.go index eafe5f3b2bdd..cf3c3f355c9f 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/tag_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/tag_client.go @@ -30,8 +30,7 @@ type TagClient struct { } // NewTagClient creates a new instance of TagClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewTagClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TagClient, error) { @@ -49,8 +48,8 @@ func NewTagClient(subscriptionID string, credential azcore.TokenCredential, opti // AssignToAPI - Assign tag to the Api. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -99,7 +98,7 @@ func (client *TagClient) assignToAPICreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -120,8 +119,8 @@ func (client *TagClient) assignToAPIHandleResponse(resp *http.Response) (TagClie // AssignToOperation - Assign tag to the Operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -175,7 +174,7 @@ func (client *TagClient) assignToOperationCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,8 +192,8 @@ func (client *TagClient) assignToOperationHandleResponse(resp *http.Response) (T // AssignToProduct - Assign tag to the Product. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - tagID - Tag identifier. Must be unique in the current API Management service instance. @@ -242,7 +241,7 @@ func (client *TagClient) assignToProductCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -260,8 +259,8 @@ func (client *TagClient) assignToProductHandleResponse(resp *http.Response) (Tag // CreateOrUpdate - Creates a tag. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - tagID - Tag identifier. Must be unique in the current API Management service instance. // - parameters - Create parameters. @@ -305,7 +304,7 @@ func (client *TagClient) createOrUpdateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -329,8 +328,8 @@ func (client *TagClient) createOrUpdateHandleResponse(resp *http.Response) (TagC // Delete - Deletes specific tag of the API Management service instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - tagID - Tag identifier. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -375,7 +374,7 @@ func (client *TagClient) deleteCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -385,8 +384,8 @@ func (client *TagClient) deleteCreateRequest(ctx context.Context, resourceGroupN // DetachFromAPI - Detach the tag from the Api. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -435,7 +434,7 @@ func (client *TagClient) detachFromAPICreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -444,8 +443,8 @@ func (client *TagClient) detachFromAPICreateRequest(ctx context.Context, resourc // DetachFromOperation - Detach the tag from the Operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -499,7 +498,7 @@ func (client *TagClient) detachFromOperationCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -508,8 +507,8 @@ func (client *TagClient) detachFromOperationCreateRequest(ctx context.Context, r // DetachFromProduct - Detach the tag from the Product. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - tagID - Tag identifier. Must be unique in the current API Management service instance. @@ -557,7 +556,7 @@ func (client *TagClient) detachFromProductCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -566,8 +565,8 @@ func (client *TagClient) detachFromProductCreateRequest(ctx context.Context, res // Get - Gets the details of the tag specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - tagID - Tag identifier. Must be unique in the current API Management service instance. // - options - TagClientGetOptions contains the optional parameters for the TagClient.Get method. @@ -610,7 +609,7 @@ func (client *TagClient) getCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -631,8 +630,8 @@ func (client *TagClient) getHandleResponse(resp *http.Response) (TagClientGetRes // GetByAPI - Get tag associated with the API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -681,7 +680,7 @@ func (client *TagClient) getByAPICreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -702,8 +701,8 @@ func (client *TagClient) getByAPIHandleResponse(resp *http.Response) (TagClientG // GetByOperation - Get tag associated with the Operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -757,7 +756,7 @@ func (client *TagClient) getByOperationCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -778,8 +777,8 @@ func (client *TagClient) getByOperationHandleResponse(resp *http.Response) (TagC // GetByProduct - Get tag associated with the Product. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - tagID - Tag identifier. Must be unique in the current API Management service instance. @@ -827,7 +826,7 @@ func (client *TagClient) getByProductCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -847,8 +846,8 @@ func (client *TagClient) getByProductHandleResponse(resp *http.Response) (TagCli // GetEntityState - Gets the entity state version of the tag specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - tagID - Tag identifier. Must be unique in the current API Management service instance. // - options - TagClientGetEntityStateOptions contains the optional parameters for the TagClient.GetEntityState method. @@ -891,7 +890,7 @@ func (client *TagClient) getEntityStateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -909,8 +908,8 @@ func (client *TagClient) getEntityStateHandleResponse(resp *http.Response) (TagC // GetEntityStateByAPI - Gets the entity state version of the tag specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -959,7 +958,7 @@ func (client *TagClient) getEntityStateByAPICreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -977,8 +976,8 @@ func (client *TagClient) getEntityStateByAPIHandleResponse(resp *http.Response) // GetEntityStateByOperation - Gets the entity state version of the tag specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -1033,7 +1032,7 @@ func (client *TagClient) getEntityStateByOperationCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1051,8 +1050,8 @@ func (client *TagClient) getEntityStateByOperationHandleResponse(resp *http.Resp // GetEntityStateByProduct - Gets the entity state version of the tag specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - tagID - Tag identifier. Must be unique in the current API Management service instance. @@ -1101,7 +1100,7 @@ func (client *TagClient) getEntityStateByProductCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1119,8 +1118,8 @@ func (client *TagClient) getEntityStateByProductHandleResponse(resp *http.Respon // NewListByAPIPager - Lists all Tags associated with the API. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -1186,7 +1185,7 @@ func (client *TagClient) listByAPICreateRequest(ctx context.Context, resourceGro if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1203,8 +1202,8 @@ func (client *TagClient) listByAPIHandleResponse(resp *http.Response) (TagClient // NewListByOperationPager - Lists all Tags associated with the Operation. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has // ;rev=n as a suffix where n is the revision number. @@ -1275,7 +1274,7 @@ func (client *TagClient) listByOperationCreateRequest(ctx context.Context, resou if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1292,8 +1291,8 @@ func (client *TagClient) listByOperationHandleResponse(resp *http.Response) (Tag // NewListByProductPager - Lists all Tags associated with the Product. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - productID - Product identifier. Must be unique in the current API Management service instance. // - options - TagClientListByProductOptions contains the optional parameters for the TagClient.NewListByProductPager method. @@ -1358,7 +1357,7 @@ func (client *TagClient) listByProductCreateRequest(ctx context.Context, resourc if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1375,8 +1374,8 @@ func (client *TagClient) listByProductHandleResponse(resp *http.Response) (TagCl // NewListByServicePager - Lists a collection of tags defined within a service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - TagClientListByServiceOptions contains the optional parameters for the TagClient.NewListByServicePager method. func (client *TagClient) NewListByServicePager(resourceGroupName string, serviceName string, options *TagClientListByServiceOptions) *runtime.Pager[TagClientListByServiceResponse] { @@ -1439,7 +1438,7 @@ func (client *TagClient) listByServiceCreateRequest(ctx context.Context, resourc if options != nil && options.Scope != nil { reqQP.Set("scope", *options.Scope) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1457,8 +1456,8 @@ func (client *TagClient) listByServiceHandleResponse(resp *http.Response) (TagCl // Update - Updates the details of the tag specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - tagID - Tag identifier. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -1504,7 +1503,7 @@ func (client *TagClient) updateCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tag_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/tag_client_example_test.go deleted file mode 100644 index 77a4ff3c87a8..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/tag_client_example_test.go +++ /dev/null @@ -1,584 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiOperationTags.json -func ExampleTagClient_NewListByOperationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTagClient().NewListByOperationPager("rg1", "apimService1", "57d2ef278aa04f0888cba3f3", "57d2ef278aa04f0888cba3f6", &armapimanagement.TagClientListByOperationOptions{Filter: nil, - Top: nil, - Skip: 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.TagCollection = armapimanagement.TagCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.TagContract{ - // { - // Name: to.Ptr("5600b539c53f5b0062060002"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/5600b539c53f5b0062060002"), - // Properties: &armapimanagement.TagContractProperties{ - // DisplayName: to.Ptr("tag1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiOperationTag.json -func ExampleTagClient_GetEntityStateByOperation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTagClient().GetEntityStateByOperation(ctx, "rg1", "apimService1", "59d6bb8f1f7fab13dc67ec9b", "59d6bb8f1f7fab13dc67ec9a", "59306a29e4bbd510dc24e5f9", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationTag.json -func ExampleTagClient_GetByOperation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTagClient().GetByOperation(ctx, "rg1", "apimService1", "59d6bb8f1f7fab13dc67ec9b", "59d6bb8f1f7fab13dc67ec9a", "59306a29e4bbd510dc24e5f9", 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.TagContract = armapimanagement.TagContract{ - // Name: to.Ptr("59306a29e4bbd510dc24e5f9"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/59306a29e4bbd510dc24e5f9"), - // Properties: &armapimanagement.TagContractProperties{ - // DisplayName: to.Ptr("tag1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiOperationTag.json -func ExampleTagClient_AssignToOperation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTagClient().AssignToOperation(ctx, "rg1", "apimService1", "5931a75ae4bbd512a88c680b", "5931a75ae4bbd512a88c680a", "tagId1", 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.TagContract = armapimanagement.TagContract{ - // Name: to.Ptr("tagId1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/tagId1"), - // Properties: &armapimanagement.TagContractProperties{ - // DisplayName: to.Ptr("tag1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiOperationTag.json -func ExampleTagClient_DetachFromOperation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTagClient().DetachFromOperation(ctx, "rg1", "apimService1", "59d5b28d1f7fab116c282650", "59d5b28d1f7fab116c282651", "59d5b28e1f7fab116402044e", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiTags.json -func ExampleTagClient_NewListByAPIPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTagClient().NewListByAPIPager("rg1", "apimService1", "57d2ef278aa04f0888cba3f3", &armapimanagement.TagClientListByAPIOptions{Filter: nil, - Top: nil, - Skip: 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.TagCollection = armapimanagement.TagCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.TagContract{ - // { - // Name: to.Ptr("5600b539c53f5b0062060002"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/5600b539c53f5b0062060002"), - // Properties: &armapimanagement.TagContractProperties{ - // DisplayName: to.Ptr("tag1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiTag.json -func ExampleTagClient_GetEntityStateByAPI() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTagClient().GetEntityStateByAPI(ctx, "rg1", "apimService1", "59d6bb8f1f7fab13dc67ec9b", "59306a29e4bbd510dc24e5f9", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiTag.json -func ExampleTagClient_GetByAPI() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTagClient().GetByAPI(ctx, "rg1", "apimService1", "59d6bb8f1f7fab13dc67ec9b", "59306a29e4bbd510dc24e5f9", 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.TagContract = armapimanagement.TagContract{ - // Name: to.Ptr("59306a29e4bbd510dc24e5f9"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/59306a29e4bbd510dc24e5f9"), - // Properties: &armapimanagement.TagContractProperties{ - // DisplayName: to.Ptr("tag1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiTag.json -func ExampleTagClient_AssignToAPI() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTagClient().AssignToAPI(ctx, "rg1", "apimService1", "5931a75ae4bbd512a88c680b", "tagId1", 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.TagContract = armapimanagement.TagContract{ - // Name: to.Ptr("tagId1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/tagId1"), - // Properties: &armapimanagement.TagContractProperties{ - // DisplayName: to.Ptr("tag1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiTag.json -func ExampleTagClient_DetachFromAPI() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTagClient().DetachFromAPI(ctx, "rg1", "apimService1", "59d5b28d1f7fab116c282650", "59d5b28e1f7fab116402044e", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductTags.json -func ExampleTagClient_NewListByProductPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTagClient().NewListByProductPager("rg1", "apimService1", "57d2ef278aa04f0888cba3f1", &armapimanagement.TagClientListByProductOptions{Filter: nil, - Top: nil, - Skip: 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.TagCollection = armapimanagement.TagCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.TagContract{ - // { - // Name: to.Ptr("5600b539c53f5b0062060002"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/5600b539c53f5b0062060002"), - // Properties: &armapimanagement.TagContractProperties{ - // DisplayName: to.Ptr("tag1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProductTag.json -func ExampleTagClient_GetEntityStateByProduct() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTagClient().GetEntityStateByProduct(ctx, "rg1", "apimService1", "59306a29e4bbd510dc24e5f8", "59306a29e4bbd510dc24e5f9", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProductTag.json -func ExampleTagClient_GetByProduct() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTagClient().GetByProduct(ctx, "rg1", "apimService1", "59d6bb8f1f7fab13dc67ec9b", "59306a29e4bbd510dc24e5f9", 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.TagContract = armapimanagement.TagContract{ - // Name: to.Ptr("59306a29e4bbd510dc24e5f9"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/59306a29e4bbd510dc24e5f9"), - // Properties: &armapimanagement.TagContractProperties{ - // DisplayName: to.Ptr("tag1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProductTag.json -func ExampleTagClient_AssignToProduct() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTagClient().AssignToProduct(ctx, "rg1", "apimService1", "5931a75ae4bbd512a88c680b", "tagId1", 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.TagContract = armapimanagement.TagContract{ - // Name: to.Ptr("tagId1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/tagId1"), - // Properties: &armapimanagement.TagContractProperties{ - // DisplayName: to.Ptr("tag1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProductTag.json -func ExampleTagClient_DetachFromProduct() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTagClient().DetachFromProduct(ctx, "rg1", "apimService1", "59d5b28d1f7fab116c282650", "59d5b28e1f7fab116402044e", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTags.json -func ExampleTagClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTagClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.TagClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: nil, - Scope: 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.TagCollection = armapimanagement.TagCollection{ - // Count: to.Ptr[int64](2), - // Value: []*armapimanagement.TagContract{ - // { - // Name: to.Ptr("5600b59375ff190048020001"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/5600b59375ff190048020001"), - // Properties: &armapimanagement.TagContractProperties{ - // DisplayName: to.Ptr("tag1"), - // }, - // }, - // { - // Name: to.Ptr("5600b59375ff190048020002"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/5600b59375ff190048020002"), - // Properties: &armapimanagement.TagContractProperties{ - // DisplayName: to.Ptr("tag2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadTag.json -func ExampleTagClient_GetEntityState() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTagClient().GetEntityState(ctx, "rg1", "apimService1", "59306a29e4bbd510dc24e5f9", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTag.json -func ExampleTagClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTagClient().Get(ctx, "rg1", "apimService1", "59306a29e4bbd510dc24e5f9", 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.TagContract = armapimanagement.TagContract{ - // Name: to.Ptr("59306a29e4bbd510dc24e5f9"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/59306a29e4bbd510dc24e5f9"), - // Properties: &armapimanagement.TagContractProperties{ - // DisplayName: to.Ptr("tag1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateTag.json -func ExampleTagClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTagClient().CreateOrUpdate(ctx, "rg1", "apimService1", "tagId1", armapimanagement.TagCreateUpdateParameters{ - Properties: &armapimanagement.TagContractProperties{ - DisplayName: to.Ptr("tag1"), - }, - }, &armapimanagement.TagClientCreateOrUpdateOptions{IfMatch: 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.TagContract = armapimanagement.TagContract{ - // Name: to.Ptr("tagId1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/tagId1"), - // Properties: &armapimanagement.TagContractProperties{ - // DisplayName: to.Ptr("tag1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateTag.json -func ExampleTagClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTagClient().Update(ctx, "rg1", "apimService1", "temptag", "*", armapimanagement.TagCreateUpdateParameters{ - Properties: &armapimanagement.TagContractProperties{ - DisplayName: to.Ptr("temp tag"), - }, - }, 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.TagContract = armapimanagement.TagContract{ - // Name: to.Ptr("temptag"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tags/temptag"), - // Properties: &armapimanagement.TagContractProperties{ - // DisplayName: to.Ptr("tag1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteTag.json -func ExampleTagClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTagClient().Delete(ctx, "rg1", "apimService1", "tagId1", "*", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tagapilink_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/tagapilink_client.go new file mode 100644 index 000000000000..05c740048d60 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/tagapilink_client.go @@ -0,0 +1,327 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// TagAPILinkClient contains the methods for the TagAPILink group. +// Don't use this type directly, use NewTagAPILinkClient() instead. +type TagAPILinkClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTagAPILinkClient creates a new instance of TagAPILinkClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTagAPILinkClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TagAPILinkClient, error) { + cl, err := arm.NewClient(moduleName+".TagAPILinkClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TagAPILinkClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Adds an API to the specified tag via link. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - apiLinkID - Tag-API link identifier. Must be unique in the current API Management service instance. +// - parameters - Create or update parameters. +// - options - TagAPILinkClientCreateOrUpdateOptions contains the optional parameters for the TagAPILinkClient.CreateOrUpdate +// method. +func (client *TagAPILinkClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, tagID string, apiLinkID string, parameters TagAPILinkContract, options *TagAPILinkClientCreateOrUpdateOptions) (TagAPILinkClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, tagID, apiLinkID, parameters, options) + if err != nil { + return TagAPILinkClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagAPILinkClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return TagAPILinkClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *TagAPILinkClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, tagID string, apiLinkID string, parameters TagAPILinkContract, options *TagAPILinkClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if apiLinkID == "" { + return nil, errors.New("parameter apiLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiLinkId}", url.PathEscape(apiLinkID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *TagAPILinkClient) createOrUpdateHandleResponse(resp *http.Response) (TagAPILinkClientCreateOrUpdateResponse, error) { + result := TagAPILinkClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagAPILinkContract); err != nil { + return TagAPILinkClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified API from the specified tag. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - apiLinkID - Tag-API link identifier. Must be unique in the current API Management service instance. +// - options - TagAPILinkClientDeleteOptions contains the optional parameters for the TagAPILinkClient.Delete method. +func (client *TagAPILinkClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, tagID string, apiLinkID string, options *TagAPILinkClientDeleteOptions) (TagAPILinkClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, tagID, apiLinkID, options) + if err != nil { + return TagAPILinkClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagAPILinkClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return TagAPILinkClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return TagAPILinkClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TagAPILinkClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, tagID string, apiLinkID string, options *TagAPILinkClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if apiLinkID == "" { + return nil, errors.New("parameter apiLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiLinkId}", url.PathEscape(apiLinkID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the API link for the tag. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - apiLinkID - Tag-API link identifier. Must be unique in the current API Management service instance. +// - options - TagAPILinkClientGetOptions contains the optional parameters for the TagAPILinkClient.Get method. +func (client *TagAPILinkClient) Get(ctx context.Context, resourceGroupName string, serviceName string, tagID string, apiLinkID string, options *TagAPILinkClientGetOptions) (TagAPILinkClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, tagID, apiLinkID, options) + if err != nil { + return TagAPILinkClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagAPILinkClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TagAPILinkClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *TagAPILinkClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, tagID string, apiLinkID string, options *TagAPILinkClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if apiLinkID == "" { + return nil, errors.New("parameter apiLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiLinkId}", url.PathEscape(apiLinkID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TagAPILinkClient) getHandleResponse(resp *http.Response) (TagAPILinkClientGetResponse, error) { + result := TagAPILinkClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.TagAPILinkContract); err != nil { + return TagAPILinkClientGetResponse{}, err + } + return result, nil +} + +// NewListByProductPager - Lists a collection of the API links associated with a tag. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - options - TagAPILinkClientListByProductOptions contains the optional parameters for the TagAPILinkClient.NewListByProductPager +// method. +func (client *TagAPILinkClient) NewListByProductPager(resourceGroupName string, serviceName string, tagID string, options *TagAPILinkClientListByProductOptions) *runtime.Pager[TagAPILinkClientListByProductResponse] { + return runtime.NewPager(runtime.PagingHandler[TagAPILinkClientListByProductResponse]{ + More: func(page TagAPILinkClientListByProductResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TagAPILinkClientListByProductResponse) (TagAPILinkClientListByProductResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByProductCreateRequest(ctx, resourceGroupName, serviceName, tagID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return TagAPILinkClientListByProductResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagAPILinkClientListByProductResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TagAPILinkClientListByProductResponse{}, runtime.NewResponseError(resp) + } + return client.listByProductHandleResponse(resp) + }, + }) +} + +// listByProductCreateRequest creates the ListByProduct request. +func (client *TagAPILinkClient) listByProductCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, tagID string, options *TagAPILinkClientListByProductOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProductHandleResponse handles the ListByProduct response. +func (client *TagAPILinkClient) listByProductHandleResponse(resp *http.Response) (TagAPILinkClientListByProductResponse, error) { + result := TagAPILinkClientListByProductResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagAPILinkCollection); err != nil { + return TagAPILinkClientListByProductResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tagoperationlink_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/tagoperationlink_client.go new file mode 100644 index 000000000000..2f5acf7eab5f --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/tagoperationlink_client.go @@ -0,0 +1,327 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// TagOperationLinkClient contains the methods for the TagOperationLink group. +// Don't use this type directly, use NewTagOperationLinkClient() instead. +type TagOperationLinkClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTagOperationLinkClient creates a new instance of TagOperationLinkClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTagOperationLinkClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TagOperationLinkClient, error) { + cl, err := arm.NewClient(moduleName+".TagOperationLinkClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TagOperationLinkClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Adds an operation to the specified tag via link. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - operationLinkID - Tag-operation link identifier. Must be unique in the current API Management service instance. +// - parameters - Create or update parameters. +// - options - TagOperationLinkClientCreateOrUpdateOptions contains the optional parameters for the TagOperationLinkClient.CreateOrUpdate +// method. +func (client *TagOperationLinkClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, tagID string, operationLinkID string, parameters TagOperationLinkContract, options *TagOperationLinkClientCreateOrUpdateOptions) (TagOperationLinkClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, tagID, operationLinkID, parameters, options) + if err != nil { + return TagOperationLinkClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagOperationLinkClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return TagOperationLinkClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *TagOperationLinkClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, tagID string, operationLinkID string, parameters TagOperationLinkContract, options *TagOperationLinkClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if operationLinkID == "" { + return nil, errors.New("parameter operationLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationLinkId}", url.PathEscape(operationLinkID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *TagOperationLinkClient) createOrUpdateHandleResponse(resp *http.Response) (TagOperationLinkClientCreateOrUpdateResponse, error) { + result := TagOperationLinkClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagOperationLinkContract); err != nil { + return TagOperationLinkClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified operation from the specified tag. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - operationLinkID - Tag-operation link identifier. Must be unique in the current API Management service instance. +// - options - TagOperationLinkClientDeleteOptions contains the optional parameters for the TagOperationLinkClient.Delete method. +func (client *TagOperationLinkClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, tagID string, operationLinkID string, options *TagOperationLinkClientDeleteOptions) (TagOperationLinkClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, tagID, operationLinkID, options) + if err != nil { + return TagOperationLinkClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagOperationLinkClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return TagOperationLinkClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return TagOperationLinkClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TagOperationLinkClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, tagID string, operationLinkID string, options *TagOperationLinkClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if operationLinkID == "" { + return nil, errors.New("parameter operationLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationLinkId}", url.PathEscape(operationLinkID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the operation link for the tag. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - operationLinkID - Tag-operation link identifier. Must be unique in the current API Management service instance. +// - options - TagOperationLinkClientGetOptions contains the optional parameters for the TagOperationLinkClient.Get method. +func (client *TagOperationLinkClient) Get(ctx context.Context, resourceGroupName string, serviceName string, tagID string, operationLinkID string, options *TagOperationLinkClientGetOptions) (TagOperationLinkClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, tagID, operationLinkID, options) + if err != nil { + return TagOperationLinkClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagOperationLinkClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TagOperationLinkClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *TagOperationLinkClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, tagID string, operationLinkID string, options *TagOperationLinkClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if operationLinkID == "" { + return nil, errors.New("parameter operationLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationLinkId}", url.PathEscape(operationLinkID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TagOperationLinkClient) getHandleResponse(resp *http.Response) (TagOperationLinkClientGetResponse, error) { + result := TagOperationLinkClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.TagOperationLinkContract); err != nil { + return TagOperationLinkClientGetResponse{}, err + } + return result, nil +} + +// NewListByProductPager - Lists a collection of the operation links associated with a tag. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - options - TagOperationLinkClientListByProductOptions contains the optional parameters for the TagOperationLinkClient.NewListByProductPager +// method. +func (client *TagOperationLinkClient) NewListByProductPager(resourceGroupName string, serviceName string, tagID string, options *TagOperationLinkClientListByProductOptions) *runtime.Pager[TagOperationLinkClientListByProductResponse] { + return runtime.NewPager(runtime.PagingHandler[TagOperationLinkClientListByProductResponse]{ + More: func(page TagOperationLinkClientListByProductResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TagOperationLinkClientListByProductResponse) (TagOperationLinkClientListByProductResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByProductCreateRequest(ctx, resourceGroupName, serviceName, tagID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return TagOperationLinkClientListByProductResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagOperationLinkClientListByProductResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TagOperationLinkClientListByProductResponse{}, runtime.NewResponseError(resp) + } + return client.listByProductHandleResponse(resp) + }, + }) +} + +// listByProductCreateRequest creates the ListByProduct request. +func (client *TagOperationLinkClient) listByProductCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, tagID string, options *TagOperationLinkClientListByProductOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProductHandleResponse handles the ListByProduct response. +func (client *TagOperationLinkClient) listByProductHandleResponse(resp *http.Response) (TagOperationLinkClientListByProductResponse, error) { + result := TagOperationLinkClientListByProductResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagOperationLinkCollection); err != nil { + return TagOperationLinkClientListByProductResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tagproductlink_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/tagproductlink_client.go new file mode 100644 index 000000000000..67c88b09a18e --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/tagproductlink_client.go @@ -0,0 +1,327 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// TagProductLinkClient contains the methods for the TagProductLink group. +// Don't use this type directly, use NewTagProductLinkClient() instead. +type TagProductLinkClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTagProductLinkClient creates a new instance of TagProductLinkClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTagProductLinkClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TagProductLinkClient, error) { + cl, err := arm.NewClient(moduleName+".TagProductLinkClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TagProductLinkClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Adds a product to the specified tag via link. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - productLinkID - Tag-product link identifier. Must be unique in the current API Management service instance. +// - parameters - Create or update parameters. +// - options - TagProductLinkClientCreateOrUpdateOptions contains the optional parameters for the TagProductLinkClient.CreateOrUpdate +// method. +func (client *TagProductLinkClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, tagID string, productLinkID string, parameters TagProductLinkContract, options *TagProductLinkClientCreateOrUpdateOptions) (TagProductLinkClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, tagID, productLinkID, parameters, options) + if err != nil { + return TagProductLinkClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagProductLinkClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return TagProductLinkClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *TagProductLinkClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, tagID string, productLinkID string, parameters TagProductLinkContract, options *TagProductLinkClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if productLinkID == "" { + return nil, errors.New("parameter productLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productLinkId}", url.PathEscape(productLinkID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *TagProductLinkClient) createOrUpdateHandleResponse(resp *http.Response) (TagProductLinkClientCreateOrUpdateResponse, error) { + result := TagProductLinkClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagProductLinkContract); err != nil { + return TagProductLinkClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified product from the specified tag. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - productLinkID - Tag-product link identifier. Must be unique in the current API Management service instance. +// - options - TagProductLinkClientDeleteOptions contains the optional parameters for the TagProductLinkClient.Delete method. +func (client *TagProductLinkClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, tagID string, productLinkID string, options *TagProductLinkClientDeleteOptions) (TagProductLinkClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, tagID, productLinkID, options) + if err != nil { + return TagProductLinkClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagProductLinkClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return TagProductLinkClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return TagProductLinkClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TagProductLinkClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, tagID string, productLinkID string, options *TagProductLinkClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if productLinkID == "" { + return nil, errors.New("parameter productLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productLinkId}", url.PathEscape(productLinkID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the product link for the tag. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - productLinkID - Tag-product link identifier. Must be unique in the current API Management service instance. +// - options - TagProductLinkClientGetOptions contains the optional parameters for the TagProductLinkClient.Get method. +func (client *TagProductLinkClient) Get(ctx context.Context, resourceGroupName string, serviceName string, tagID string, productLinkID string, options *TagProductLinkClientGetOptions) (TagProductLinkClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, tagID, productLinkID, options) + if err != nil { + return TagProductLinkClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagProductLinkClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TagProductLinkClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *TagProductLinkClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, tagID string, productLinkID string, options *TagProductLinkClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if productLinkID == "" { + return nil, errors.New("parameter productLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productLinkId}", url.PathEscape(productLinkID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TagProductLinkClient) getHandleResponse(resp *http.Response) (TagProductLinkClientGetResponse, error) { + result := TagProductLinkClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.TagProductLinkContract); err != nil { + return TagProductLinkClientGetResponse{}, err + } + return result, nil +} + +// NewListByProductPager - Lists a collection of the product links associated with a tag. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - options - TagProductLinkClientListByProductOptions contains the optional parameters for the TagProductLinkClient.NewListByProductPager +// method. +func (client *TagProductLinkClient) NewListByProductPager(resourceGroupName string, serviceName string, tagID string, options *TagProductLinkClientListByProductOptions) *runtime.Pager[TagProductLinkClientListByProductResponse] { + return runtime.NewPager(runtime.PagingHandler[TagProductLinkClientListByProductResponse]{ + More: func(page TagProductLinkClientListByProductResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TagProductLinkClientListByProductResponse) (TagProductLinkClientListByProductResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByProductCreateRequest(ctx, resourceGroupName, serviceName, tagID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return TagProductLinkClientListByProductResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagProductLinkClientListByProductResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TagProductLinkClientListByProductResponse{}, runtime.NewResponseError(resp) + } + return client.listByProductHandleResponse(resp) + }, + }) +} + +// listByProductCreateRequest creates the ListByProduct request. +func (client *TagProductLinkClient) listByProductCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, tagID string, options *TagProductLinkClientListByProductOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProductHandleResponse handles the ListByProduct response. +func (client *TagProductLinkClient) listByProductHandleResponse(resp *http.Response) (TagProductLinkClientListByProductResponse, error) { + result := TagProductLinkClientListByProductResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagProductLinkCollection); err != nil { + return TagProductLinkClientListByProductResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tagresource_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/tagresource_client.go index aebcbfe36506..6f5618b5da42 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/tagresource_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/tagresource_client.go @@ -30,8 +30,7 @@ type TagResourceClient struct { } // NewTagResourceClient creates a new instance of TagResourceClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewTagResourceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TagResourceClient, error) { @@ -48,8 +47,8 @@ func NewTagResourceClient(subscriptionID string, credential azcore.TokenCredenti // NewListByServicePager - Lists a collection of resources associated with tags. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - TagResourceClientListByServiceOptions contains the optional parameters for the TagResourceClient.NewListByServicePager // method. @@ -110,7 +109,7 @@ func (client *TagResourceClient) listByServiceCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tagresource_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/tagresource_client_example_test.go deleted file mode 100644 index 75af910d3b5b..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/tagresource_client_example_test.go +++ /dev/null @@ -1,94 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTagResources.json -func ExampleTagResourceClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTagResourceClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.TagResourceClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: 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.TagResourceCollection = armapimanagement.TagResourceCollection{ - // Value: []*armapimanagement.TagResourceContract{ - // { - // Operation: &armapimanagement.OperationTagResourceContractProperties{ - // Name: to.Ptr("Create resource"), - // Method: to.Ptr("POST"), - // Description: to.Ptr("A demonstration of a POST call based on the echo backend above. The request body is expected to contain JSON-formatted data (see example below). A policy is used to automatically transform any request sent in JSON directly to XML. In a real-world scenario this could be used to enable modern clients to speak to a legacy backend."), - // APIName: to.Ptr("Echo API"), - // APIRevision: to.Ptr("1"), - // ID: to.Ptr("/apis/echo-api/operations/create-resource"), - // URLTemplate: to.Ptr("/resource"), - // }, - // Tag: &armapimanagement.TagResourceContractProperties{ - // Name: to.Ptr("awesomeTag"), - // ID: to.Ptr("/tags/apitag123"), - // }, - // }, - // { - // API: &armapimanagement.APITagResourceContractProperties{ - // APIRevision: to.Ptr("1"), - // IsCurrent: to.Ptr(true), - // Name: to.Ptr("Echo API"), - // Path: to.Ptr("echo"), - // ID: to.Ptr("/apis/echo-api"), - // ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api"), - // }, - // Tag: &armapimanagement.TagResourceContractProperties{ - // Name: to.Ptr("awesomeTag"), - // ID: to.Ptr("/tags/apitag123"), - // }, - // }, - // { - // Product: &armapimanagement.ProductTagResourceContractProperties{ - // Description: to.Ptr("Subscribers will be able to run 5 calls/minute up to a maximum of 100 calls/week."), - // ApprovalRequired: to.Ptr(false), - // State: to.Ptr(armapimanagement.ProductStatePublished), - // SubscriptionRequired: to.Ptr(true), - // SubscriptionsLimit: to.Ptr[int32](1), - // Terms: to.Ptr(""), - // Name: to.Ptr("Starter"), - // ID: to.Ptr("/products/starter"), - // }, - // Tag: &armapimanagement.TagResourceContractProperties{ - // Name: to.Ptr("awesomeTag"), - // ID: to.Ptr("/tags/apitag123"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tenantaccess_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/tenantaccess_client.go index 48e4423619f3..212cfc0d4447 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/tenantaccess_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/tenantaccess_client.go @@ -29,8 +29,7 @@ type TenantAccessClient struct { } // NewTenantAccessClient creates a new instance of TenantAccessClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewTenantAccessClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TenantAccessClient, error) { @@ -48,8 +47,8 @@ func NewTenantAccessClient(subscriptionID string, credential azcore.TokenCredent // Create - Update tenant access information details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - accessName - The identifier of the Access configuration. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -95,7 +94,7 @@ func (client *TenantAccessClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -117,8 +116,8 @@ func (client *TenantAccessClient) createHandleResponse(resp *http.Response) (Ten // Get - Get tenant access information details without secrets. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - accessName - The identifier of the Access configuration. // - options - TenantAccessClientGetOptions contains the optional parameters for the TenantAccessClient.Get method. @@ -161,7 +160,7 @@ func (client *TenantAccessClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,8 +180,8 @@ func (client *TenantAccessClient) getHandleResponse(resp *http.Response) (Tenant // GetEntityTag - Tenant access metadata // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - accessName - The identifier of the Access configuration. // - options - TenantAccessClientGetEntityTagOptions contains the optional parameters for the TenantAccessClient.GetEntityTag @@ -226,7 +225,7 @@ func (client *TenantAccessClient) getEntityTagCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -244,8 +243,8 @@ func (client *TenantAccessClient) getEntityTagHandleResponse(resp *http.Response // NewListByServicePager - Returns list of access infos - for Git and Management endpoints. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - TenantAccessClientListByServiceOptions contains the optional parameters for the TenantAccessClient.NewListByServicePager // method. @@ -300,7 +299,7 @@ func (client *TenantAccessClient) listByServiceCreateRequest(ctx context.Context if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -318,8 +317,8 @@ func (client *TenantAccessClient) listByServiceHandleResponse(resp *http.Respons // ListSecrets - Get tenant access information details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - accessName - The identifier of the Access configuration. // - options - TenantAccessClientListSecretsOptions contains the optional parameters for the TenantAccessClient.ListSecrets @@ -363,7 +362,7 @@ func (client *TenantAccessClient) listSecretsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -384,8 +383,8 @@ func (client *TenantAccessClient) listSecretsHandleResponse(resp *http.Response) // RegeneratePrimaryKey - Regenerate primary access key // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - accessName - The identifier of the Access configuration. // - options - TenantAccessClientRegeneratePrimaryKeyOptions contains the optional parameters for the TenantAccessClient.RegeneratePrimaryKey @@ -429,7 +428,7 @@ func (client *TenantAccessClient) regeneratePrimaryKeyCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -438,8 +437,8 @@ func (client *TenantAccessClient) regeneratePrimaryKeyCreateRequest(ctx context. // RegenerateSecondaryKey - Regenerate secondary access key // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - accessName - The identifier of the Access configuration. // - options - TenantAccessClientRegenerateSecondaryKeyOptions contains the optional parameters for the TenantAccessClient.RegenerateSecondaryKey @@ -483,7 +482,7 @@ func (client *TenantAccessClient) regenerateSecondaryKeyCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -492,8 +491,8 @@ func (client *TenantAccessClient) regenerateSecondaryKeyCreateRequest(ctx contex // Update - Update tenant access information details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - accessName - The identifier of the Access configuration. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -539,7 +538,7 @@ func (client *TenantAccessClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tenantaccess_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/tenantaccess_client_example_test.go deleted file mode 100644 index b9d850ff8763..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/tenantaccess_client_example_test.go +++ /dev/null @@ -1,237 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTenantAccess.json -func ExampleTenantAccessClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantAccessClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.TenantAccessClientListByServiceOptions{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.AccessInformationCollection = armapimanagement.AccessInformationCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.AccessInformationContract{ - // { - // Name: to.Ptr("access"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tenant"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tenant/access"), - // Properties: &armapimanagement.AccessInformationContractProperties{ - // Enabled: to.Ptr(true), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadTenantAccess.json -func ExampleTenantAccessClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTenantAccessClient().GetEntityTag(ctx, "rg1", "apimService1", armapimanagement.AccessIDNameAccess, 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantAccess.json -func ExampleTenantAccessClient_Get_apiManagementGetTenantAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantAccessClient().Get(ctx, "rg1", "apimService1", armapimanagement.AccessIDNameAccess, 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.AccessInformationContract = armapimanagement.AccessInformationContract{ - // Name: to.Ptr("access"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tenant"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tenant/access"), - // Properties: &armapimanagement.AccessInformationContractProperties{ - // Enabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantGitAccess.json -func ExampleTenantAccessClient_Get_apiManagementGetTenantGitAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantAccessClient().Get(ctx, "rg1", "apimService1", armapimanagement.AccessIDNameGitAccess, 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.AccessInformationContract = armapimanagement.AccessInformationContract{ - // Name: to.Ptr("gitAccess"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tenant"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tenant/gitAccess"), - // Properties: &armapimanagement.AccessInformationContractProperties{ - // Enabled: to.Ptr(true), - // PrincipalID: to.Ptr("git"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateTenantAccess.json -func ExampleTenantAccessClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantAccessClient().Create(ctx, "rg1", "apimService1", armapimanagement.AccessIDNameAccess, "*", armapimanagement.AccessInformationCreateParameters{ - Properties: &armapimanagement.AccessInformationCreateParameterProperties{ - Enabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessInformationContract = armapimanagement.AccessInformationContract{ - // Name: to.Ptr("access"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tenant"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tenant/access"), - // Properties: &armapimanagement.AccessInformationContractProperties{ - // Enabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateTenantAccess.json -func ExampleTenantAccessClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantAccessClient().Update(ctx, "rg1", "apimService1", armapimanagement.AccessIDNameAccess, "*", armapimanagement.AccessInformationUpdateParameters{ - Properties: &armapimanagement.AccessInformationUpdateParameterProperties{ - Enabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessInformationContract = armapimanagement.AccessInformationContract{ - // Name: to.Ptr("access"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tenant"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tenant/access"), - // Properties: &armapimanagement.AccessInformationContractProperties{ - // Enabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantAccessRegenerateKey.json -func ExampleTenantAccessClient_RegeneratePrimaryKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTenantAccessClient().RegeneratePrimaryKey(ctx, "rg1", "apimService1", armapimanagement.AccessIDNameAccess, 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSecretsTenantAccess.json -func ExampleTenantAccessClient_ListSecrets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantAccessClient().ListSecrets(ctx, "rg1", "apimService1", armapimanagement.AccessIDNameAccess, 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.AccessInformationSecretsContract = armapimanagement.AccessInformationSecretsContract{ - // Enabled: to.Ptr(true), - // ID: to.Ptr("5600b59375ff190048030003"), - // PrimaryKey: to.Ptr(""), - // SecondaryKey: to.Ptr(""), - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tenantaccessgit_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/tenantaccessgit_client.go index e593914005a1..2ea927812982 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/tenantaccessgit_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/tenantaccessgit_client.go @@ -29,8 +29,7 @@ type TenantAccessGitClient struct { } // NewTenantAccessGitClient creates a new instance of TenantAccessGitClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewTenantAccessGitClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TenantAccessGitClient, error) { @@ -48,8 +47,8 @@ func NewTenantAccessGitClient(subscriptionID string, credential azcore.TokenCred // RegeneratePrimaryKey - Regenerate primary access key for GIT. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - accessName - The identifier of the Access configuration. // - options - TenantAccessGitClientRegeneratePrimaryKeyOptions contains the optional parameters for the TenantAccessGitClient.RegeneratePrimaryKey @@ -93,7 +92,7 @@ func (client *TenantAccessGitClient) regeneratePrimaryKeyCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -102,8 +101,8 @@ func (client *TenantAccessGitClient) regeneratePrimaryKeyCreateRequest(ctx conte // RegenerateSecondaryKey - Regenerate secondary access key for GIT. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - accessName - The identifier of the Access configuration. // - options - TenantAccessGitClientRegenerateSecondaryKeyOptions contains the optional parameters for the TenantAccessGitClient.RegenerateSecondaryKey @@ -147,7 +146,7 @@ func (client *TenantAccessGitClient) regenerateSecondaryKeyCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tenantaccessgit_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/tenantaccessgit_client_example_test.go deleted file mode 100644 index 0ec55ce1c92b..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/tenantaccessgit_client_example_test.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantAccessRegenerateKey.json -func ExampleTenantAccessGitClient_RegeneratePrimaryKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTenantAccessGitClient().RegeneratePrimaryKey(ctx, "rg1", "apimService1", armapimanagement.AccessIDNameAccess, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tenantconfiguration_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/tenantconfiguration_client.go index 7ad87a966c1a..c02dac92137f 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/tenantconfiguration_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/tenantconfiguration_client.go @@ -29,8 +29,7 @@ type TenantConfigurationClient struct { } // NewTenantConfigurationClient creates a new instance of TenantConfigurationClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewTenantConfigurationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TenantConfigurationClient, error) { @@ -49,8 +48,8 @@ func NewTenantConfigurationClient(subscriptionID string, credential azcore.Token // running operation and could take several minutes to complete. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - configurationName - The identifier of the Git Configuration Operation. // - parameters - Deploy Configuration parameters. @@ -74,7 +73,7 @@ func (client *TenantConfigurationClient) BeginDeploy(ctx context.Context, resour // operation and could take several minutes to complete. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *TenantConfigurationClient) deploy(ctx context.Context, resourceGroupName string, serviceName string, configurationName ConfigurationIDName, parameters DeployConfigurationParameters, options *TenantConfigurationClientBeginDeployOptions) (*http.Response, error) { req, err := client.deployCreateRequest(ctx, resourceGroupName, serviceName, configurationName, parameters, options) if err != nil { @@ -114,7 +113,7 @@ func (client *TenantConfigurationClient) deployCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -123,8 +122,8 @@ func (client *TenantConfigurationClient) deployCreateRequest(ctx context.Context // GetSyncState - Gets the status of the most recent synchronization between the configuration database and the Git repository. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - configurationName - The identifier of the Git Configuration Operation. // - options - TenantConfigurationClientGetSyncStateOptions contains the optional parameters for the TenantConfigurationClient.GetSyncState @@ -168,7 +167,7 @@ func (client *TenantConfigurationClient) getSyncStateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -187,8 +186,8 @@ func (client *TenantConfigurationClient) getSyncStateHandleResponse(resp *http.R // This is a long running operation and could take several minutes to complete. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - configurationName - The identifier of the Git Configuration Operation. // - parameters - Save Configuration parameters. @@ -212,7 +211,7 @@ func (client *TenantConfigurationClient) BeginSave(ctx context.Context, resource // This is a long running operation and could take several minutes to complete. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *TenantConfigurationClient) save(ctx context.Context, resourceGroupName string, serviceName string, configurationName ConfigurationIDName, parameters SaveConfigurationParameter, options *TenantConfigurationClientBeginSaveOptions) (*http.Response, error) { req, err := client.saveCreateRequest(ctx, resourceGroupName, serviceName, configurationName, parameters, options) if err != nil { @@ -252,7 +251,7 @@ func (client *TenantConfigurationClient) saveCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -262,8 +261,8 @@ func (client *TenantConfigurationClient) saveCreateRequest(ctx context.Context, // could take several minutes to complete. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - configurationName - The identifier of the Git Configuration Operation. // - parameters - Validate Configuration parameters. @@ -287,7 +286,7 @@ func (client *TenantConfigurationClient) BeginValidate(ctx context.Context, reso // take several minutes to complete. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 +// Generated from API version 2023-03-01-preview func (client *TenantConfigurationClient) validate(ctx context.Context, resourceGroupName string, serviceName string, configurationName ConfigurationIDName, parameters DeployConfigurationParameters, options *TenantConfigurationClientBeginValidateOptions) (*http.Response, error) { req, err := client.validateCreateRequest(ctx, resourceGroupName, serviceName, configurationName, parameters, options) if err != nil { @@ -327,7 +326,7 @@ func (client *TenantConfigurationClient) validateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tenantconfiguration_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/tenantconfiguration_client_example_test.go deleted file mode 100644 index 1c91da09553b..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/tenantconfiguration_client_example_test.go +++ /dev/null @@ -1,178 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantConfigurationDeploy.json -func ExampleTenantConfigurationClient_BeginDeploy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTenantConfigurationClient().BeginDeploy(ctx, "rg1", "apimService1", armapimanagement.ConfigurationIDNameConfiguration, armapimanagement.DeployConfigurationParameters{ - Properties: &armapimanagement.DeployConfigurationParameterProperties{ - Branch: to.Ptr("master"), - }, - }, 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.OperationResultContract = armapimanagement.OperationResultContract{ - // Name: to.Ptr("6074e652093a9d0dac3d733c"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tenant/operationResults"), - // ID: to.Ptr("6074e652093a9d0dac3d733c"), - // Properties: &armapimanagement.OperationResultContractProperties{ - // Error: &armapimanagement.ErrorResponseBody{ - // Code: to.Ptr("ValidationError"), - // Message: to.Ptr("File not found: 'api-management/configuration.json'"), - // }, - // Started: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-26T17:06:54.303Z"); return t}()), - // Status: to.Ptr(armapimanagement.AsyncOperationStatusFailed), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-26T17:07:21.777Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantConfigurationSave.json -func ExampleTenantConfigurationClient_BeginSave() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTenantConfigurationClient().BeginSave(ctx, "rg1", "apimService1", armapimanagement.ConfigurationIDNameConfiguration, armapimanagement.SaveConfigurationParameter{ - Properties: &armapimanagement.SaveConfigurationParameterProperties{ - Branch: to.Ptr("master"), - }, - }, 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.OperationResultContract = armapimanagement.OperationResultContract{ - // Name: to.Ptr("6074e652093a9d0dac3d733c"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tenant/operationResults"), - // ID: to.Ptr("6074e652093a9d0dac3d733c"), - // Properties: &armapimanagement.OperationResultContractProperties{ - // ActionLog: []*armapimanagement.OperationResultLogItemContract{ - // }, - // ResultInfo: to.Ptr("The configuration was successfully saved to master as commit c0ae274f6046912107bad734834cbf65918668b6."), - // Started: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-13T00:31:14.94Z"); return t}()), - // Status: to.Ptr(armapimanagement.AsyncOperationStatusSucceeded), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-13T00:31:27.59Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantConfigurationValidate.json -func ExampleTenantConfigurationClient_BeginValidate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTenantConfigurationClient().BeginValidate(ctx, "rg1", "apimService1", armapimanagement.ConfigurationIDNameConfiguration, armapimanagement.DeployConfigurationParameters{ - Properties: &armapimanagement.DeployConfigurationParameterProperties{ - Branch: to.Ptr("master"), - }, - }, 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.OperationResultContract = armapimanagement.OperationResultContract{ - // Name: to.Ptr("6074ec02093a9d0dac3d7345"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tenant/operationResults"), - // ID: to.Ptr("6074ec02093a9d0dac3d7345"), - // Properties: &armapimanagement.OperationResultContractProperties{ - // ActionLog: []*armapimanagement.OperationResultLogItemContract{ - // }, - // ResultInfo: to.Ptr("Validation is successfull"), - // Started: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-13T00:55:30.62Z"); return t}()), - // Status: to.Ptr(armapimanagement.AsyncOperationStatusSucceeded), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-13T00:55:39.857Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantAccessSyncState.json -func ExampleTenantConfigurationClient_GetSyncState() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantConfigurationClient().GetSyncState(ctx, "rg1", "apimService1", armapimanagement.ConfigurationIDNameConfiguration, 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.TenantConfigurationSyncStateContract = armapimanagement.TenantConfigurationSyncStateContract{ - // Name: to.Ptr("syncState"), - // Type: to.Ptr("Microsoft.ApiManagement/service/tenant/syncState"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tenant/configuration/syncState"), - // Properties: &armapimanagement.TenantConfigurationSyncStateContractProperties{ - // Branch: to.Ptr("master"), - // CommitID: to.Ptr("de891c2342c7058dde45e5e624eae7e558c94683"), - // ConfigurationChangeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-13T00:11:43.862781Z"); return t}()), - // IsExport: to.Ptr(true), - // IsGitEnabled: to.Ptr(true), - // IsSynced: to.Ptr(true), - // LastOperationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tenant/configuration/operationResults/6074f0bd093a9d0dac3d7347"), - // SyncDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-13T01:15:53.9824995Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tenantsettings_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/tenantsettings_client.go index ea135acdb38c..ee16b03caac0 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/tenantsettings_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/tenantsettings_client.go @@ -29,8 +29,7 @@ type TenantSettingsClient struct { } // NewTenantSettingsClient creates a new instance of TenantSettingsClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewTenantSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TenantSettingsClient, error) { @@ -48,8 +47,8 @@ func NewTenantSettingsClient(subscriptionID string, credential azcore.TokenCrede // Get - Get tenant settings. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - settingsType - The identifier of the settings. // - options - TenantSettingsClientGetOptions contains the optional parameters for the TenantSettingsClient.Get method. @@ -92,7 +91,7 @@ func (client *TenantSettingsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -112,8 +111,8 @@ func (client *TenantSettingsClient) getHandleResponse(resp *http.Response) (Tena // NewListByServicePager - Public settings. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - TenantSettingsClientListByServiceOptions contains the optional parameters for the TenantSettingsClient.NewListByServicePager // method. @@ -168,7 +167,7 @@ func (client *TenantSettingsClient) listByServiceCreateRequest(ctx context.Conte if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/tenantsettings_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/tenantsettings_client_example_test.go deleted file mode 100644 index 4d66420d5270..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/tenantsettings_client_example_test.go +++ /dev/null @@ -1,96 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTenantSettings.json -func ExampleTenantSettingsClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantSettingsClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.TenantSettingsClientListByServiceOptions{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.TenantSettingsCollection = armapimanagement.TenantSettingsCollection{ - // Value: []*armapimanagement.TenantSettingsContract{ - // { - // Name: to.Ptr("public"), - // Type: to.Ptr("Microsoft.ApiManagement/service/settings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/settings/public"), - // Properties: &armapimanagement.TenantSettingsContractProperties{ - // Settings: map[string]*string{ - // "CustomPortalSettings.DelegatedSubscriptionEnabled": to.Ptr("False"), - // "CustomPortalSettings.DelegationEnabled": to.Ptr("False"), - // "CustomPortalSettings.DelegationUrl": to.Ptr(""), - // "CustomPortalSettings.UserRegistrationTerms": nil, - // "CustomPortalSettings.UserRegistrationTermsConsentRequired": to.Ptr("False"), - // "CustomPortalSettings.UserRegistrationTermsEnabled": to.Ptr("False"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantSettings.json -func ExampleTenantSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantSettingsClient().Get(ctx, "rg1", "apimService1", armapimanagement.SettingsTypeNamePublic, 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.TenantSettingsContract = armapimanagement.TenantSettingsContract{ - // Name: to.Ptr("public"), - // Type: to.Ptr("Microsoft.ApiManagement/service/settings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/settings/public"), - // Properties: &armapimanagement.TenantSettingsContractProperties{ - // Settings: map[string]*string{ - // "CustomPortalSettings.DelegatedSubscriptionEnabled": to.Ptr("False"), - // "CustomPortalSettings.DelegationEnabled": to.Ptr("False"), - // "CustomPortalSettings.DelegationUrl": to.Ptr(""), - // "CustomPortalSettings.UserRegistrationTerms": nil, - // "CustomPortalSettings.UserRegistrationTermsConsentRequired": to.Ptr("False"), - // "CustomPortalSettings.UserRegistrationTermsEnabled": to.Ptr("False"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/user_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/user_client.go index 50ed86deb290..681dea9ed5dc 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/user_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/user_client.go @@ -30,8 +30,7 @@ type UserClient struct { } // NewUserClient creates a new instance of UserClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewUserClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UserClient, error) { @@ -49,8 +48,8 @@ func NewUserClient(subscriptionID string, credential azcore.TokenCredential, opt // CreateOrUpdate - Creates or Updates a user. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - userID - User identifier. Must be unique in the current API Management service instance. // - parameters - Create or update parameters. @@ -97,7 +96,7 @@ func (client *UserClient) createOrUpdateCreateRequest(ctx context.Context, resou if options != nil && options.Notify != nil { reqQP.Set("notify", strconv.FormatBool(*options.Notify)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -121,8 +120,8 @@ func (client *UserClient) createOrUpdateHandleResponse(resp *http.Response) (Use // Delete - Deletes specific user. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - userID - User identifier. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -173,7 +172,7 @@ func (client *UserClient) deleteCreateRequest(ctx context.Context, resourceGroup if options != nil && options.Notify != nil { reqQP.Set("notify", strconv.FormatBool(*options.Notify)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") if options != nil && options.AppType != nil { reqQP.Set("appType", string(*options.AppType)) } @@ -187,8 +186,8 @@ func (client *UserClient) deleteCreateRequest(ctx context.Context, resourceGroup // portal. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - userID - User identifier. Must be unique in the current API Management service instance. // - options - UserClientGenerateSsoURLOptions contains the optional parameters for the UserClient.GenerateSsoURL method. @@ -231,7 +230,7 @@ func (client *UserClient) generateSsoURLCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,8 +248,8 @@ func (client *UserClient) generateSsoURLHandleResponse(resp *http.Response) (Use // Get - Gets the details of the user specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - userID - User identifier. Must be unique in the current API Management service instance. // - options - UserClientGetOptions contains the optional parameters for the UserClient.Get method. @@ -293,7 +292,7 @@ func (client *UserClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -313,8 +312,8 @@ func (client *UserClient) getHandleResponse(resp *http.Response) (UserClientGetR // GetEntityTag - Gets the entity state (Etag) version of the user specified by its identifier. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - userID - User identifier. Must be unique in the current API Management service instance. // - options - UserClientGetEntityTagOptions contains the optional parameters for the UserClient.GetEntityTag method. @@ -357,7 +356,7 @@ func (client *UserClient) getEntityTagCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -376,8 +375,8 @@ func (client *UserClient) getEntityTagHandleResponse(resp *http.Response) (UserC // GetSharedAccessToken - Gets the Shared Access Authorization Token for the User. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - userID - User identifier. Must be unique in the current API Management service instance. // - parameters - Create Authorization Token parameters. @@ -422,7 +421,7 @@ func (client *UserClient) getSharedAccessTokenCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -439,8 +438,8 @@ func (client *UserClient) getSharedAccessTokenHandleResponse(resp *http.Response // NewListByServicePager - Lists a collection of registered users in the specified service instance. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - options - UserClientListByServiceOptions contains the optional parameters for the UserClient.NewListByServicePager method. func (client *UserClient) NewListByServicePager(resourceGroupName string, serviceName string, options *UserClientListByServiceOptions) *runtime.Pager[UserClientListByServiceResponse] { @@ -503,7 +502,7 @@ func (client *UserClient) listByServiceCreateRequest(ctx context.Context, resour if options != nil && options.ExpandGroups != nil { reqQP.Set("expandGroups", strconv.FormatBool(*options.ExpandGroups)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -521,8 +520,8 @@ func (client *UserClient) listByServiceHandleResponse(resp *http.Response) (User // Update - Updates the details of the user specified by its identifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - userID - User identifier. Must be unique in the current API Management service instance. // - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or @@ -568,7 +567,7 @@ func (client *UserClient) updateCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/user_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/user_client_example_test.go deleted file mode 100644 index 986456eb7551..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/user_client_example_test.go +++ /dev/null @@ -1,321 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "time" - - "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/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListUsers.json -func ExampleUserClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUserClient().NewListByServicePager("rg1", "apimService1", &armapimanagement.UserClientListByServiceOptions{Filter: nil, - Top: nil, - Skip: nil, - ExpandGroups: 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.UserCollection = armapimanagement.UserCollection{ - // Count: to.Ptr[int64](3), - // Value: []*armapimanagement.UserContract{ - // { - // Name: to.Ptr("1"), - // Type: to.Ptr("Microsoft.ApiManagement/service/users"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - // Properties: &armapimanagement.UserContractProperties{ - // Identities: []*armapimanagement.UserIdentityContract{ - // { - // ID: to.Ptr("admin@live.com"), - // Provider: to.Ptr("Azure"), - // }}, - // State: to.Ptr(armapimanagement.UserStateActive), - // Email: to.Ptr("admin@live.com"), - // FirstName: to.Ptr("Administrator"), - // LastName: to.Ptr(""), - // RegistrationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-09-22T01:57:39.677Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("56eaec62baf08b06e46d27fd"), - // Type: to.Ptr("Microsoft.ApiManagement/service/users"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/56eaec62baf08b06e46d27fd"), - // Properties: &armapimanagement.UserContractProperties{ - // Identities: []*armapimanagement.UserIdentityContract{ - // { - // ID: to.Ptr("foo.bar.83@gmail.com"), - // Provider: to.Ptr("Basic"), - // }}, - // State: to.Ptr(armapimanagement.UserStateActive), - // Email: to.Ptr("foo.bar.83@gmail.com"), - // FirstName: to.Ptr("foo"), - // LastName: to.Ptr("bar"), - // RegistrationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-03-17T17:41:56.327Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("5931a75ae4bbd512a88c680b"), - // Type: to.Ptr("Microsoft.ApiManagement/service/users"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/5931a75ae4bbd512a88c680b"), - // Properties: &armapimanagement.UserContractProperties{ - // Identities: []*armapimanagement.UserIdentityContract{ - // { - // ID: to.Ptr("*************"), - // Provider: to.Ptr("Microsoft"), - // }}, - // State: to.Ptr(armapimanagement.UserStateActive), - // Email: to.Ptr("foobar@outlook.com"), - // FirstName: to.Ptr("foo"), - // LastName: to.Ptr("bar"), - // RegistrationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T17:58:50.357Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadUser.json -func ExampleUserClient_GetEntityTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewUserClient().GetEntityTag(ctx, "rg1", "apimService1", "5931a75ae4bbd512a88c680b", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetUser.json -func ExampleUserClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewUserClient().Get(ctx, "rg1", "apimService1", "5931a75ae4bbd512a88c680b", 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.UserContract = armapimanagement.UserContract{ - // Name: to.Ptr("5931a75ae4bbd512a88c680b"), - // Type: to.Ptr("Microsoft.ApiManagement/service/users"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/5931a75ae4bbd512a88c680b"), - // Properties: &armapimanagement.UserContractProperties{ - // Identities: []*armapimanagement.UserIdentityContract{ - // { - // ID: to.Ptr("*************"), - // Provider: to.Ptr("Microsoft"), - // }}, - // State: to.Ptr(armapimanagement.UserStateActive), - // Email: to.Ptr("foobar@outlook.com"), - // FirstName: to.Ptr("foo"), - // LastName: to.Ptr("bar"), - // RegistrationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T17:58:50.357Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateUser.json -func ExampleUserClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewUserClient().CreateOrUpdate(ctx, "rg1", "apimService1", "5931a75ae4bbd512288c680b", armapimanagement.UserCreateParameters{ - Properties: &armapimanagement.UserCreateParameterProperties{ - Confirmation: to.Ptr(armapimanagement.ConfirmationSignup), - Email: to.Ptr("foobar@outlook.com"), - FirstName: to.Ptr("foo"), - LastName: to.Ptr("bar"), - }, - }, &armapimanagement.UserClientCreateOrUpdateOptions{Notify: nil, - IfMatch: 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.UserContract = armapimanagement.UserContract{ - // Name: to.Ptr("5931a75ae4bbd512288c680b"), - // Type: to.Ptr("Microsoft.ApiManagement/service/users"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/5931a75ae4bbd512288c680b"), - // Properties: &armapimanagement.UserContractProperties{ - // Identities: []*armapimanagement.UserIdentityContract{ - // { - // ID: to.Ptr("foobar@outlook.com"), - // Provider: to.Ptr("Basic"), - // }}, - // State: to.Ptr(armapimanagement.UserStateActive), - // Email: to.Ptr("foobar@outlook.com"), - // FirstName: to.Ptr("foo"), - // Groups: []*armapimanagement.GroupContractProperties{ - // }, - // LastName: to.Ptr("bar"), - // RegistrationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-07T21:21:29.16Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateUser.json -func ExampleUserClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewUserClient().Update(ctx, "rg1", "apimService1", "5931a75ae4bbd512a88c680b", "*", armapimanagement.UserUpdateParameters{ - Properties: &armapimanagement.UserUpdateParametersProperties{ - Email: to.Ptr("foobar@outlook.com"), - FirstName: to.Ptr("foo"), - LastName: to.Ptr("bar"), - }, - }, 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.UserContract = armapimanagement.UserContract{ - // Name: to.Ptr("5931a75ae4bbd512a88c680b"), - // Type: to.Ptr("Microsoft.ApiManagement/service/users"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/5931a75ae4bbd512a88c680b"), - // Properties: &armapimanagement.UserContractProperties{ - // Identities: []*armapimanagement.UserIdentityContract{ - // { - // ID: to.Ptr("*************"), - // Provider: to.Ptr("Microsoft"), - // }}, - // State: to.Ptr(armapimanagement.UserStateActive), - // Email: to.Ptr("foobar@outlook.com"), - // FirstName: to.Ptr("foo"), - // LastName: to.Ptr("bar"), - // RegistrationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T17:58:50.357Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteUser.json -func ExampleUserClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewUserClient().Delete(ctx, "rg1", "apimService1", "5931a75ae4bbd512288c680b", "*", &armapimanagement.UserClientDeleteOptions{DeleteSubscriptions: nil, - Notify: nil, - AppType: 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUserGenerateSsoUrl.json -func ExampleUserClient_GenerateSsoURL() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewUserClient().GenerateSsoURL(ctx, "rg1", "apimService1", "57127d485157a511ace86ae7", 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.GenerateSsoURLResult = armapimanagement.GenerateSsoURLResult{ - // Value: to.Ptr("https://apimService1.portal.azure-api.net/signin-sso?token=57127d485157a511ace86ae7%26201706051624%267VY18MlwAom***********2bYr2bDQHg21OzQsNakExQ%3d%3d"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUserToken.json -func ExampleUserClient_GetSharedAccessToken() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewUserClient().GetSharedAccessToken(ctx, "rg1", "apimService1", "userId1718", armapimanagement.UserTokenParameters{ - Properties: &armapimanagement.UserTokenParameterProperties{ - Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-21T00:44:24.2845269Z"); return t }()), - KeyType: to.Ptr(armapimanagement.KeyTypePrimary), - }, - }, 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.UserTokenResult = armapimanagement.UserTokenResult{ - // Value: to.Ptr("userId1718&201904210044&9A1GR1f5WIhFvFmzQG+xxxxxxxxxxx/kBeu87DWad3tkasUXuvPL+MgzlwUHyg=="), - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/userconfirmationpassword_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/userconfirmationpassword_client.go index 670665918030..96c4156ddcfc 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/userconfirmationpassword_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/userconfirmationpassword_client.go @@ -29,8 +29,7 @@ type UserConfirmationPasswordClient struct { } // NewUserConfirmationPasswordClient creates a new instance of UserConfirmationPasswordClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewUserConfirmationPasswordClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UserConfirmationPasswordClient, error) { @@ -48,8 +47,8 @@ func NewUserConfirmationPasswordClient(subscriptionID string, credential azcore. // Send - Sends confirmation // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - userID - User identifier. Must be unique in the current API Management service instance. // - options - UserConfirmationPasswordClientSendOptions contains the optional parameters for the UserConfirmationPasswordClient.Send @@ -93,7 +92,7 @@ func (client *UserConfirmationPasswordClient) sendCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") if options != nil && options.AppType != nil { reqQP.Set("appType", string(*options.AppType)) } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/userconfirmationpassword_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/userconfirmationpassword_client_example_test.go deleted file mode 100644 index 728b7726471b..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/userconfirmationpassword_client_example_test.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUserConfirmationPasswordSend.json -func ExampleUserConfirmationPasswordClient_Send() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewUserConfirmationPasswordClient().Send(ctx, "rg1", "apimService1", "57127d485157a511ace86ae7", &armapimanagement.UserConfirmationPasswordClientSendOptions{AppType: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/usergroup_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/usergroup_client.go index 7c9710b74859..248119d203c1 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/usergroup_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/usergroup_client.go @@ -30,8 +30,7 @@ type UserGroupClient struct { } // NewUserGroupClient creates a new instance of UserGroupClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewUserGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UserGroupClient, error) { @@ -48,8 +47,8 @@ func NewUserGroupClient(subscriptionID string, credential azcore.TokenCredential // NewListPager - Lists all user groups. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - userID - User identifier. Must be unique in the current API Management service instance. // - options - UserGroupClientListOptions contains the optional parameters for the UserGroupClient.NewListPager method. @@ -114,7 +113,7 @@ func (client *UserGroupClient) listCreateRequest(ctx context.Context, resourceGr if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/usergroup_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/usergroup_client_example_test.go deleted file mode 100644 index 064c3ff66fcf..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/usergroup_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListUserGroups.json -func ExampleUserGroupClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUserGroupClient().NewListPager("rg1", "apimService1", "57681833a40f7eb6c49f6acf", &armapimanagement.UserGroupClientListOptions{Filter: nil, - Top: nil, - Skip: 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.GroupCollection = armapimanagement.GroupCollection{ - // Count: to.Ptr[int64](1), - // Value: []*armapimanagement.GroupContract{ - // { - // Name: to.Ptr("5600b57e7e8880006a020002"), - // Type: to.Ptr("Microsoft.ApiManagement/service/users/groups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57681833a40f7eb6c49f6acf/groups/5600b57e7e8880006a020002"), - // Properties: &armapimanagement.GroupContractProperties{ - // Type: to.Ptr(armapimanagement.GroupTypeSystem), - // Description: to.Ptr("Developers is a built-in group. Its membership is managed by the system. Signed-in users fall into this group."), - // BuiltIn: to.Ptr(true), - // DisplayName: to.Ptr("Developers"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/useridentities_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/useridentities_client.go index 7645b813b424..eda75d965e38 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/useridentities_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/useridentities_client.go @@ -29,8 +29,7 @@ type UserIdentitiesClient struct { } // NewUserIdentitiesClient creates a new instance of UserIdentitiesClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewUserIdentitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UserIdentitiesClient, error) { @@ -47,8 +46,8 @@ func NewUserIdentitiesClient(subscriptionID string, credential azcore.TokenCrede // NewListPager - List of all user identities. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - userID - User identifier. Must be unique in the current API Management service instance. // - options - UserIdentitiesClientListOptions contains the optional parameters for the UserIdentitiesClient.NewListPager method. @@ -104,7 +103,7 @@ func (client *UserIdentitiesClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/useridentities_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/useridentities_client_example_test.go deleted file mode 100644 index cf8914e5cd72..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/useridentities_client_example_test.go +++ /dev/null @@ -1,50 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListUserIdentities.json -func ExampleUserIdentitiesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUserIdentitiesClient().NewListPager("rg1", "apimService1", "57f2af53bb17172280f44057", 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.UserIdentityCollection = armapimanagement.UserIdentityCollection{ - // Value: []*armapimanagement.UserIdentityContract{ - // { - // ID: to.Ptr("086cf9********55ab"), - // Provider: to.Ptr("Microsoft"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/usersubscription_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/usersubscription_client.go index c32d258d2e27..06fa549c5867 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/usersubscription_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/usersubscription_client.go @@ -30,8 +30,7 @@ type UserSubscriptionClient struct { } // NewUserSubscriptionClient creates a new instance of UserSubscriptionClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewUserSubscriptionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UserSubscriptionClient, error) { @@ -49,8 +48,8 @@ func NewUserSubscriptionClient(subscriptionID string, credential azcore.TokenCre // Get - Gets the specified Subscription entity associated with a particular user. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - userID - User identifier. Must be unique in the current API Management service instance. // - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. @@ -98,7 +97,7 @@ func (client *UserSubscriptionClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -118,8 +117,8 @@ func (client *UserSubscriptionClient) getHandleResponse(resp *http.Response) (Us // NewListPager - Lists the collection of subscriptions of the specified user. // -// Generated from API version 2021-08-01 -// - resourceGroupName - The name of the resource group. +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of the API Management service. // - userID - User identifier. Must be unique in the current API Management service instance. // - options - UserSubscriptionClientListOptions contains the optional parameters for the UserSubscriptionClient.NewListPager @@ -185,7 +184,7 @@ func (client *UserSubscriptionClient) listCreateRequest(ctx context.Context, res if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/usersubscription_client_example_test.go b/sdk/resourcemanager/apimanagement/armapimanagement/usersubscription_client_example_test.go deleted file mode 100644 index 0583f11c7aaf..000000000000 --- a/sdk/resourcemanager/apimanagement/armapimanagement/usersubscription_client_example_test.go +++ /dev/null @@ -1,107 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapimanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListUserSubscriptions.json -func ExampleUserSubscriptionClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUserSubscriptionClient().NewListPager("rg1", "apimService1", "57681833a40f7eb6c49f6acf", &armapimanagement.UserSubscriptionClientListOptions{Filter: nil, - Top: nil, - Skip: 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.SubscriptionCollection = armapimanagement.SubscriptionCollection{ - // Value: []*armapimanagement.SubscriptionContract{ - // { - // Name: to.Ptr("57681850a40f7eb6c49f6ae3"), - // Type: to.Ptr("Microsoft.ApiManagement/service/users/subscriptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57681833a40f7eb6c49f6acf/subscriptions/57681850a40f7eb6c49f6ae3"), - // Properties: &armapimanagement.SubscriptionContractProperties{ - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-06-20T16:22:39.547Z"); return t}()), - // DisplayName: to.Ptr("57681850a40f7eb6c49f6ae5"), - // OwnerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57681833a40f7eb6c49f6acf"), - // Scope: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5768181ea40f7eb6c49f6ac7"), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-06-20T00:00:00Z"); return t}()), - // State: to.Ptr(armapimanagement.SubscriptionStateActive), - // }, - // }, - // { - // Name: to.Ptr("57681850a40f7eb6c49f6b2b"), - // Type: to.Ptr("Microsoft.ApiManagement/service/users/subscriptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57681833a40f7eb6c49f6acf/subscriptions/57681850a40f7eb6c49f6b2b"), - // Properties: &armapimanagement.SubscriptionContractProperties{ - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-06-20T16:22:41.103Z"); return t}()), - // DisplayName: to.Ptr("57681850a40f7eb6c49f6b2d"), - // OwnerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57681833a40f7eb6c49f6acf"), - // Scope: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5768181ea40f7eb6c49f6ac7"), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-06-20T00:00:00Z"); return t}()), - // State: to.Ptr(armapimanagement.SubscriptionStateActive), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetUserSubscription.json -func ExampleUserSubscriptionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapimanagement.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewUserSubscriptionClient().Get(ctx, "rg1", "apimService1", "1", "5fa9b096f3df14003c070001", 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.SubscriptionContract = armapimanagement.SubscriptionContract{ - // Name: to.Ptr("5fa9b096f3df14003c070001"), - // Type: to.Ptr("Microsoft.ApiManagement/service/users/subscriptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1/subscriptions/5fa9b096f3df14003c070001"), - // Properties: &armapimanagement.SubscriptionContractProperties{ - // AllowTracing: to.Ptr(true), - // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-09T21:11:50.58Z"); return t}()), - // OwnerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), - // Scope: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/starter"), - // State: to.Ptr(armapimanagement.SubscriptionStateActive), - // }, - // } -} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspace_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspace_client.go new file mode 100644 index 000000000000..cbee787fc7a6 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspace_client.go @@ -0,0 +1,447 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceClient contains the methods for the Workspace group. +// Don't use this type directly, use NewWorkspaceClient() instead. +type WorkspaceClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceClient creates a new instance of WorkspaceClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates a new workspace or updates an existing one. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - parameters - Create parameters. +// - options - WorkspaceClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceClient.CreateOrUpdate +// method. +func (client *WorkspaceClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, parameters WorkspaceContract, options *WorkspaceClientCreateOrUpdateOptions) (WorkspaceClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, parameters, options) + if err != nil { + return WorkspaceClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, parameters WorkspaceContract, options *WorkspaceClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceClientCreateOrUpdateResponse, error) { + result := WorkspaceClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceContract); err != nil { + return WorkspaceClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified workspace. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceClientDeleteOptions contains the optional parameters for the WorkspaceClient.Delete method. +func (client *WorkspaceClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, ifMatch string, options *WorkspaceClientDeleteOptions) (WorkspaceClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, ifMatch, options) + if err != nil { + return WorkspaceClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, ifMatch string, options *WorkspaceClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the workspace specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceClientGetOptions contains the optional parameters for the WorkspaceClient.Get method. +func (client *WorkspaceClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceClientGetOptions) (WorkspaceClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, options) + if err != nil { + return WorkspaceClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceClient) getHandleResponse(resp *http.Response) (WorkspaceClientGetResponse, error) { + result := WorkspaceClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceContract); err != nil { + return WorkspaceClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the workspace specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceClientGetEntityTagOptions contains the optional parameters for the WorkspaceClient.GetEntityTag method. +func (client *WorkspaceClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceClientGetEntityTagOptions) (WorkspaceClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, options) + if err != nil { + return WorkspaceClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspaceClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspaceClient) getEntityTagHandleResponse(resp *http.Response) (WorkspaceClientGetEntityTagResponse, error) { + result := WorkspaceClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByServicePager - Lists all workspaces of the API Management service instance. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - options - WorkspaceClientListByServiceOptions contains the optional parameters for the WorkspaceClient.NewListByServicePager +// method. +func (client *WorkspaceClient) NewListByServicePager(resourceGroupName string, serviceName string, options *WorkspaceClientListByServiceOptions) *runtime.Pager[WorkspaceClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceClientListByServiceResponse]{ + More: func(page WorkspaceClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceClientListByServiceResponse) (WorkspaceClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *WorkspaceClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *WorkspaceClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *WorkspaceClient) listByServiceHandleResponse(resp *http.Response) (WorkspaceClientListByServiceResponse, error) { + result := WorkspaceClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceCollection); err != nil { + return WorkspaceClientListByServiceResponse{}, err + } + return result, nil +} + +// Update - Updates the details of the workspace specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - Workspace Update parameters. +// - options - WorkspaceClientUpdateOptions contains the optional parameters for the WorkspaceClient.Update method. +func (client *WorkspaceClient) Update(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, ifMatch string, parameters WorkspaceContract, options *WorkspaceClientUpdateOptions) (WorkspaceClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, ifMatch, parameters, options) + if err != nil { + return WorkspaceClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *WorkspaceClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, ifMatch string, parameters WorkspaceContract, options *WorkspaceClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *WorkspaceClient) updateHandleResponse(resp *http.Response) (WorkspaceClientUpdateResponse, error) { + result := WorkspaceClientUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceContract); err != nil { + return WorkspaceClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapi_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapi_client.go new file mode 100644 index 000000000000..035ded7c996f --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapi_client.go @@ -0,0 +1,498 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceAPIClient contains the methods for the WorkspaceAPI group. +// Don't use this type directly, use NewWorkspaceAPIClient() instead. +type WorkspaceAPIClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceAPIClient creates a new instance of WorkspaceAPIClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceAPIClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceAPIClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceAPIClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates new or updates existing specified API of the workspace in an API Management service instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - parameters - Create or update parameters. +// - options - WorkspaceAPIClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkspaceAPIClient.BeginCreateOrUpdate +// method. +func (client *WorkspaceAPIClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, parameters APICreateOrUpdateParameter, options *WorkspaceAPIClientBeginCreateOrUpdateOptions) (*runtime.Poller[WorkspaceAPIClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serviceName, workspaceID, apiID, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WorkspaceAPIClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WorkspaceAPIClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates new or updates existing specified API of the workspace in an API Management service instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +func (client *WorkspaceAPIClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, parameters APICreateOrUpdateParameter, options *WorkspaceAPIClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceAPIClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, parameters APICreateOrUpdateParameter, options *WorkspaceAPIClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// Delete - Deletes the specified API of the workspace in an API Management service instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceAPIClientDeleteOptions contains the optional parameters for the WorkspaceAPIClient.Delete method. +func (client *WorkspaceAPIClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, ifMatch string, options *WorkspaceAPIClientDeleteOptions) (WorkspaceAPIClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, ifMatch, options) + if err != nil { + return WorkspaceAPIClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceAPIClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceAPIClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceAPIClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, ifMatch string, options *WorkspaceAPIClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.DeleteRevisions != nil { + reqQP.Set("deleteRevisions", strconv.FormatBool(*options.DeleteRevisions)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the API specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - options - WorkspaceAPIClientGetOptions contains the optional parameters for the WorkspaceAPIClient.Get method. +func (client *WorkspaceAPIClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, options *WorkspaceAPIClientGetOptions) (WorkspaceAPIClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, options) + if err != nil { + return WorkspaceAPIClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceAPIClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, options *WorkspaceAPIClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceAPIClient) getHandleResponse(resp *http.Response) (WorkspaceAPIClientGetResponse, error) { + result := WorkspaceAPIClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.APIContract); err != nil { + return WorkspaceAPIClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the API specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - options - WorkspaceAPIClientGetEntityTagOptions contains the optional parameters for the WorkspaceAPIClient.GetEntityTag +// method. +func (client *WorkspaceAPIClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, options *WorkspaceAPIClientGetEntityTagOptions) (WorkspaceAPIClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, options) + if err != nil { + return WorkspaceAPIClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspaceAPIClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, options *WorkspaceAPIClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspaceAPIClient) getEntityTagHandleResponse(resp *http.Response) (WorkspaceAPIClientGetEntityTagResponse, error) { + result := WorkspaceAPIClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByServicePager - Lists all APIs of the workspace in an API Management service instance. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceAPIClientListByServiceOptions contains the optional parameters for the WorkspaceAPIClient.NewListByServicePager +// method. +func (client *WorkspaceAPIClient) NewListByServicePager(resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceAPIClientListByServiceOptions) *runtime.Pager[WorkspaceAPIClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceAPIClientListByServiceResponse]{ + More: func(page WorkspaceAPIClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceAPIClientListByServiceResponse) (WorkspaceAPIClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceAPIClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *WorkspaceAPIClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceAPIClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.Tags != nil { + reqQP.Set("tags", *options.Tags) + } + if options != nil && options.ExpandAPIVersionSet != nil { + reqQP.Set("expandApiVersionSet", strconv.FormatBool(*options.ExpandAPIVersionSet)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *WorkspaceAPIClient) listByServiceHandleResponse(resp *http.Response) (WorkspaceAPIClientListByServiceResponse, error) { + result := WorkspaceAPIClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.APICollection); err != nil { + return WorkspaceAPIClientListByServiceResponse{}, err + } + return result, nil +} + +// Update - Updates the specified API of the workspace in an API Management service instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - API Update Contract parameters. +// - options - WorkspaceAPIClientUpdateOptions contains the optional parameters for the WorkspaceAPIClient.Update method. +func (client *WorkspaceAPIClient) Update(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, ifMatch string, parameters APIUpdateContract, options *WorkspaceAPIClientUpdateOptions) (WorkspaceAPIClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, ifMatch, parameters, options) + if err != nil { + return WorkspaceAPIClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *WorkspaceAPIClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, ifMatch string, parameters APIUpdateContract, options *WorkspaceAPIClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *WorkspaceAPIClient) updateHandleResponse(resp *http.Response) (WorkspaceAPIClientUpdateResponse, error) { + result := WorkspaceAPIClientUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.APIContract); err != nil { + return WorkspaceAPIClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapiexport_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapiexport_client.go new file mode 100644 index 000000000000..3ece4c06c817 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapiexport_client.go @@ -0,0 +1,118 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WorkspaceAPIExportClient contains the methods for the WorkspaceAPIExport group. +// Don't use this type directly, use NewWorkspaceAPIExportClient() instead. +type WorkspaceAPIExportClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceAPIExportClient creates a new instance of WorkspaceAPIExportClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceAPIExportClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceAPIExportClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceAPIExportClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceAPIExportClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets the details of the API specified by its identifier in the format specified to the Storage Blob with SAS Key +// valid for 5 minutes. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - formatParam - Format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 minutes. +// - export - Query parameter required to export the API details. +// - options - WorkspaceAPIExportClientGetOptions contains the optional parameters for the WorkspaceAPIExportClient.Get method. +func (client *WorkspaceAPIExportClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, formatParam ExportFormat, export ExportAPI, options *WorkspaceAPIExportClientGetOptions) (WorkspaceAPIExportClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, formatParam, export, options) + if err != nil { + return WorkspaceAPIExportClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIExportClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIExportClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceAPIExportClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, formatParam ExportFormat, export ExportAPI, options *WorkspaceAPIExportClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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("format", string(formatParam)) + reqQP.Set("export", string(export)) + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceAPIExportClient) getHandleResponse(resp *http.Response) (WorkspaceAPIExportClientGetResponse, error) { + result := WorkspaceAPIExportClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.APIExportResult); err != nil { + return WorkspaceAPIExportClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapioperation_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapioperation_client.go new file mode 100644 index 000000000000..93150b742efc --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapioperation_client.go @@ -0,0 +1,520 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceAPIOperationClient contains the methods for the WorkspaceAPIOperation group. +// Don't use this type directly, use NewWorkspaceAPIOperationClient() instead. +type WorkspaceAPIOperationClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceAPIOperationClient creates a new instance of WorkspaceAPIOperationClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceAPIOperationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceAPIOperationClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceAPIOperationClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceAPIOperationClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates a new operation in the API or updates an existing one. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - operationID - Operation identifier within an API. Must be unique in the current API Management service instance. +// - parameters - Create parameters. +// - options - WorkspaceAPIOperationClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceAPIOperationClient.CreateOrUpdate +// method. +func (client *WorkspaceAPIOperationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, parameters OperationContract, options *WorkspaceAPIOperationClientCreateOrUpdateOptions) (WorkspaceAPIOperationClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, operationID, parameters, options) + if err != nil { + return WorkspaceAPIOperationClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIOperationClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceAPIOperationClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceAPIOperationClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, parameters OperationContract, options *WorkspaceAPIOperationClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceAPIOperationClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceAPIOperationClientCreateOrUpdateResponse, error) { + result := WorkspaceAPIOperationClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.OperationContract); err != nil { + return WorkspaceAPIOperationClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified operation in the API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - operationID - Operation identifier within an API. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceAPIOperationClientDeleteOptions contains the optional parameters for the WorkspaceAPIOperationClient.Delete +// method. +func (client *WorkspaceAPIOperationClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, ifMatch string, options *WorkspaceAPIOperationClientDeleteOptions) (WorkspaceAPIOperationClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, operationID, ifMatch, options) + if err != nil { + return WorkspaceAPIOperationClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIOperationClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceAPIOperationClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceAPIOperationClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceAPIOperationClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, ifMatch string, options *WorkspaceAPIOperationClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the API Operation specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - operationID - Operation identifier within an API. Must be unique in the current API Management service instance. +// - options - WorkspaceAPIOperationClientGetOptions contains the optional parameters for the WorkspaceAPIOperationClient.Get +// method. +func (client *WorkspaceAPIOperationClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, options *WorkspaceAPIOperationClientGetOptions) (WorkspaceAPIOperationClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, operationID, options) + if err != nil { + return WorkspaceAPIOperationClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIOperationClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIOperationClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceAPIOperationClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, options *WorkspaceAPIOperationClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceAPIOperationClient) getHandleResponse(resp *http.Response) (WorkspaceAPIOperationClientGetResponse, error) { + result := WorkspaceAPIOperationClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.OperationContract); err != nil { + return WorkspaceAPIOperationClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the API operation specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - operationID - Operation identifier within an API. Must be unique in the current API Management service instance. +// - options - WorkspaceAPIOperationClientGetEntityTagOptions contains the optional parameters for the WorkspaceAPIOperationClient.GetEntityTag +// method. +func (client *WorkspaceAPIOperationClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, options *WorkspaceAPIOperationClientGetEntityTagOptions) (WorkspaceAPIOperationClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, operationID, options) + if err != nil { + return WorkspaceAPIOperationClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIOperationClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIOperationClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspaceAPIOperationClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, options *WorkspaceAPIOperationClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspaceAPIOperationClient) getEntityTagHandleResponse(resp *http.Response) (WorkspaceAPIOperationClientGetEntityTagResponse, error) { + result := WorkspaceAPIOperationClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByAPIPager - Lists a collection of the operations for the specified API. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - options - WorkspaceAPIOperationClientListByAPIOptions contains the optional parameters for the WorkspaceAPIOperationClient.NewListByAPIPager +// method. +func (client *WorkspaceAPIOperationClient) NewListByAPIPager(resourceGroupName string, serviceName string, workspaceID string, apiID string, options *WorkspaceAPIOperationClientListByAPIOptions) *runtime.Pager[WorkspaceAPIOperationClientListByAPIResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceAPIOperationClientListByAPIResponse]{ + More: func(page WorkspaceAPIOperationClientListByAPIResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceAPIOperationClientListByAPIResponse) (WorkspaceAPIOperationClientListByAPIResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByAPICreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceAPIOperationClientListByAPIResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIOperationClientListByAPIResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIOperationClientListByAPIResponse{}, runtime.NewResponseError(resp) + } + return client.listByAPIHandleResponse(resp) + }, + }) +} + +// listByAPICreateRequest creates the ListByAPI request. +func (client *WorkspaceAPIOperationClient) listByAPICreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, options *WorkspaceAPIOperationClientListByAPIOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.Tags != nil { + reqQP.Set("tags", *options.Tags) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByAPIHandleResponse handles the ListByAPI response. +func (client *WorkspaceAPIOperationClient) listByAPIHandleResponse(resp *http.Response) (WorkspaceAPIOperationClientListByAPIResponse, error) { + result := WorkspaceAPIOperationClientListByAPIResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationCollection); err != nil { + return WorkspaceAPIOperationClientListByAPIResponse{}, err + } + return result, nil +} + +// Update - Updates the details of the operation in the API specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - operationID - Operation identifier within an API. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - API Operation Update parameters. +// - options - WorkspaceAPIOperationClientUpdateOptions contains the optional parameters for the WorkspaceAPIOperationClient.Update +// method. +func (client *WorkspaceAPIOperationClient) Update(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, ifMatch string, parameters OperationUpdateContract, options *WorkspaceAPIOperationClientUpdateOptions) (WorkspaceAPIOperationClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, operationID, ifMatch, parameters, options) + if err != nil { + return WorkspaceAPIOperationClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIOperationClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIOperationClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *WorkspaceAPIOperationClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, ifMatch string, parameters OperationUpdateContract, options *WorkspaceAPIOperationClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *WorkspaceAPIOperationClient) updateHandleResponse(resp *http.Response) (WorkspaceAPIOperationClientUpdateResponse, error) { + result := WorkspaceAPIOperationClientUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.OperationContract); err != nil { + return WorkspaceAPIOperationClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapioperationpolicy_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapioperationpolicy_client.go new file mode 100644 index 000000000000..4053030c8a44 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapioperationpolicy_client.go @@ -0,0 +1,454 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WorkspaceAPIOperationPolicyClient contains the methods for the WorkspaceAPIOperationPolicy group. +// Don't use this type directly, use NewWorkspaceAPIOperationPolicyClient() instead. +type WorkspaceAPIOperationPolicyClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceAPIOperationPolicyClient creates a new instance of WorkspaceAPIOperationPolicyClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceAPIOperationPolicyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceAPIOperationPolicyClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceAPIOperationPolicyClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceAPIOperationPolicyClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates policy configuration for the API Operation level. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - operationID - Operation identifier within an API. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - parameters - The policy contents to apply. +// - options - WorkspaceAPIOperationPolicyClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceAPIOperationPolicyClient.CreateOrUpdate +// method. +func (client *WorkspaceAPIOperationPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, policyID PolicyIDName, parameters PolicyContract, options *WorkspaceAPIOperationPolicyClientCreateOrUpdateOptions) (WorkspaceAPIOperationPolicyClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, operationID, policyID, parameters, options) + if err != nil { + return WorkspaceAPIOperationPolicyClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIOperationPolicyClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceAPIOperationPolicyClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceAPIOperationPolicyClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, policyID PolicyIDName, parameters PolicyContract, options *WorkspaceAPIOperationPolicyClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceAPIOperationPolicyClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceAPIOperationPolicyClientCreateOrUpdateResponse, error) { + result := WorkspaceAPIOperationPolicyClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { + return WorkspaceAPIOperationPolicyClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the policy configuration at the Api Operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - operationID - Operation identifier within an API. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceAPIOperationPolicyClientDeleteOptions contains the optional parameters for the WorkspaceAPIOperationPolicyClient.Delete +// method. +func (client *WorkspaceAPIOperationPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, policyID PolicyIDName, ifMatch string, options *WorkspaceAPIOperationPolicyClientDeleteOptions) (WorkspaceAPIOperationPolicyClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, operationID, policyID, ifMatch, options) + if err != nil { + return WorkspaceAPIOperationPolicyClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIOperationPolicyClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceAPIOperationPolicyClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceAPIOperationPolicyClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceAPIOperationPolicyClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, policyID PolicyIDName, ifMatch string, options *WorkspaceAPIOperationPolicyClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the policy configuration at the API Operation level. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - operationID - Operation identifier within an API. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - options - WorkspaceAPIOperationPolicyClientGetOptions contains the optional parameters for the WorkspaceAPIOperationPolicyClient.Get +// method. +func (client *WorkspaceAPIOperationPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, policyID PolicyIDName, options *WorkspaceAPIOperationPolicyClientGetOptions) (WorkspaceAPIOperationPolicyClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, operationID, policyID, options) + if err != nil { + return WorkspaceAPIOperationPolicyClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIOperationPolicyClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIOperationPolicyClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceAPIOperationPolicyClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, policyID PolicyIDName, options *WorkspaceAPIOperationPolicyClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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() + if options != nil && options.Format != nil { + reqQP.Set("format", string(*options.Format)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceAPIOperationPolicyClient) getHandleResponse(resp *http.Response) (WorkspaceAPIOperationPolicyClientGetResponse, error) { + result := WorkspaceAPIOperationPolicyClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { + return WorkspaceAPIOperationPolicyClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the API operation policy specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - operationID - Operation identifier within an API. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - options - WorkspaceAPIOperationPolicyClientGetEntityTagOptions contains the optional parameters for the WorkspaceAPIOperationPolicyClient.GetEntityTag +// method. +func (client *WorkspaceAPIOperationPolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, policyID PolicyIDName, options *WorkspaceAPIOperationPolicyClientGetEntityTagOptions) (WorkspaceAPIOperationPolicyClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, operationID, policyID, options) + if err != nil { + return WorkspaceAPIOperationPolicyClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIOperationPolicyClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIOperationPolicyClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspaceAPIOperationPolicyClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, policyID PolicyIDName, options *WorkspaceAPIOperationPolicyClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspaceAPIOperationPolicyClient) getEntityTagHandleResponse(resp *http.Response) (WorkspaceAPIOperationPolicyClientGetEntityTagResponse, error) { + result := WorkspaceAPIOperationPolicyClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByOperationPager - Get the list of policy configuration at the API Operation level. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - operationID - Operation identifier within an API. Must be unique in the current API Management service instance. +// - options - WorkspaceAPIOperationPolicyClientListByOperationOptions contains the optional parameters for the WorkspaceAPIOperationPolicyClient.NewListByOperationPager +// method. +func (client *WorkspaceAPIOperationPolicyClient) NewListByOperationPager(resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, options *WorkspaceAPIOperationPolicyClientListByOperationOptions) *runtime.Pager[WorkspaceAPIOperationPolicyClientListByOperationResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceAPIOperationPolicyClientListByOperationResponse]{ + More: func(page WorkspaceAPIOperationPolicyClientListByOperationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceAPIOperationPolicyClientListByOperationResponse) (WorkspaceAPIOperationPolicyClientListByOperationResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByOperationCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, operationID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceAPIOperationPolicyClientListByOperationResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIOperationPolicyClientListByOperationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIOperationPolicyClientListByOperationResponse{}, runtime.NewResponseError(resp) + } + return client.listByOperationHandleResponse(resp) + }, + }) +} + +// listByOperationCreateRequest creates the ListByOperation request. +func (client *WorkspaceAPIOperationPolicyClient) listByOperationCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, operationID string, options *WorkspaceAPIOperationPolicyClientListByOperationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByOperationHandleResponse handles the ListByOperation response. +func (client *WorkspaceAPIOperationPolicyClient) listByOperationHandleResponse(resp *http.Response) (WorkspaceAPIOperationPolicyClientListByOperationResponse, error) { + result := WorkspaceAPIOperationPolicyClientListByOperationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyCollection); err != nil { + return WorkspaceAPIOperationPolicyClientListByOperationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapipolicy_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapipolicy_client.go new file mode 100644 index 000000000000..6fc2d70febae --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapipolicy_client.go @@ -0,0 +1,428 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WorkspaceAPIPolicyClient contains the methods for the WorkspaceAPIPolicy group. +// Don't use this type directly, use NewWorkspaceAPIPolicyClient() instead. +type WorkspaceAPIPolicyClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceAPIPolicyClient creates a new instance of WorkspaceAPIPolicyClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceAPIPolicyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceAPIPolicyClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceAPIPolicyClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceAPIPolicyClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates policy configuration for the API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - policyID - The identifier of the Policy. +// - parameters - The policy contents to apply. +// - options - WorkspaceAPIPolicyClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceAPIPolicyClient.CreateOrUpdate +// method. +func (client *WorkspaceAPIPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, policyID PolicyIDName, parameters PolicyContract, options *WorkspaceAPIPolicyClientCreateOrUpdateOptions) (WorkspaceAPIPolicyClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, policyID, parameters, options) + if err != nil { + return WorkspaceAPIPolicyClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIPolicyClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceAPIPolicyClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceAPIPolicyClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, policyID PolicyIDName, parameters PolicyContract, options *WorkspaceAPIPolicyClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceAPIPolicyClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceAPIPolicyClientCreateOrUpdateResponse, error) { + result := WorkspaceAPIPolicyClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { + return WorkspaceAPIPolicyClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the policy configuration at the Api. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - policyID - The identifier of the Policy. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceAPIPolicyClientDeleteOptions contains the optional parameters for the WorkspaceAPIPolicyClient.Delete +// method. +func (client *WorkspaceAPIPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, policyID PolicyIDName, ifMatch string, options *WorkspaceAPIPolicyClientDeleteOptions) (WorkspaceAPIPolicyClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, policyID, ifMatch, options) + if err != nil { + return WorkspaceAPIPolicyClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIPolicyClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceAPIPolicyClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceAPIPolicyClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceAPIPolicyClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, policyID PolicyIDName, ifMatch string, options *WorkspaceAPIPolicyClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the policy configuration at the API level. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - policyID - The identifier of the Policy. +// - options - WorkspaceAPIPolicyClientGetOptions contains the optional parameters for the WorkspaceAPIPolicyClient.Get method. +func (client *WorkspaceAPIPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, policyID PolicyIDName, options *WorkspaceAPIPolicyClientGetOptions) (WorkspaceAPIPolicyClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, policyID, options) + if err != nil { + return WorkspaceAPIPolicyClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIPolicyClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIPolicyClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceAPIPolicyClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, policyID PolicyIDName, options *WorkspaceAPIPolicyClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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() + if options != nil && options.Format != nil { + reqQP.Set("format", string(*options.Format)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceAPIPolicyClient) getHandleResponse(resp *http.Response) (WorkspaceAPIPolicyClientGetResponse, error) { + result := WorkspaceAPIPolicyClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { + return WorkspaceAPIPolicyClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the API policy specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - policyID - The identifier of the Policy. +// - options - WorkspaceAPIPolicyClientGetEntityTagOptions contains the optional parameters for the WorkspaceAPIPolicyClient.GetEntityTag +// method. +func (client *WorkspaceAPIPolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, policyID PolicyIDName, options *WorkspaceAPIPolicyClientGetEntityTagOptions) (WorkspaceAPIPolicyClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, policyID, options) + if err != nil { + return WorkspaceAPIPolicyClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIPolicyClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIPolicyClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspaceAPIPolicyClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, policyID PolicyIDName, options *WorkspaceAPIPolicyClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspaceAPIPolicyClient) getEntityTagHandleResponse(resp *http.Response) (WorkspaceAPIPolicyClientGetEntityTagResponse, error) { + result := WorkspaceAPIPolicyClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByAPIPager - Get the policy configuration at the API level. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - options - WorkspaceAPIPolicyClientListByAPIOptions contains the optional parameters for the WorkspaceAPIPolicyClient.NewListByAPIPager +// method. +func (client *WorkspaceAPIPolicyClient) NewListByAPIPager(resourceGroupName string, serviceName string, workspaceID string, apiID string, options *WorkspaceAPIPolicyClientListByAPIOptions) *runtime.Pager[WorkspaceAPIPolicyClientListByAPIResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceAPIPolicyClientListByAPIResponse]{ + More: func(page WorkspaceAPIPolicyClientListByAPIResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceAPIPolicyClientListByAPIResponse) (WorkspaceAPIPolicyClientListByAPIResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByAPICreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceAPIPolicyClientListByAPIResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIPolicyClientListByAPIResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIPolicyClientListByAPIResponse{}, runtime.NewResponseError(resp) + } + return client.listByAPIHandleResponse(resp) + }, + }) +} + +// listByAPICreateRequest creates the ListByAPI request. +func (client *WorkspaceAPIPolicyClient) listByAPICreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, options *WorkspaceAPIPolicyClientListByAPIOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByAPIHandleResponse handles the ListByAPI response. +func (client *WorkspaceAPIPolicyClient) listByAPIHandleResponse(resp *http.Response) (WorkspaceAPIPolicyClientListByAPIResponse, error) { + result := WorkspaceAPIPolicyClientListByAPIResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyCollection); err != nil { + return WorkspaceAPIPolicyClientListByAPIResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapirelease_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapirelease_client.go new file mode 100644 index 000000000000..fd9744c8caa2 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapirelease_client.go @@ -0,0 +1,512 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceAPIReleaseClient contains the methods for the WorkspaceAPIRelease group. +// Don't use this type directly, use NewWorkspaceAPIReleaseClient() instead. +type WorkspaceAPIReleaseClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceAPIReleaseClient creates a new instance of WorkspaceAPIReleaseClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceAPIReleaseClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceAPIReleaseClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceAPIReleaseClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceAPIReleaseClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates a new Release for the API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API identifier. Must be unique in the current API Management service instance. +// - releaseID - Release identifier within an API. Must be unique in the current API Management service instance. +// - parameters - Create parameters. +// - options - WorkspaceAPIReleaseClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceAPIReleaseClient.CreateOrUpdate +// method. +func (client *WorkspaceAPIReleaseClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, releaseID string, parameters APIReleaseContract, options *WorkspaceAPIReleaseClientCreateOrUpdateOptions) (WorkspaceAPIReleaseClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, releaseID, parameters, options) + if err != nil { + return WorkspaceAPIReleaseClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIReleaseClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceAPIReleaseClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceAPIReleaseClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, releaseID string, parameters APIReleaseContract, options *WorkspaceAPIReleaseClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if releaseID == "" { + return nil, errors.New("parameter releaseID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{releaseId}", url.PathEscape(releaseID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceAPIReleaseClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceAPIReleaseClientCreateOrUpdateResponse, error) { + result := WorkspaceAPIReleaseClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.APIReleaseContract); err != nil { + return WorkspaceAPIReleaseClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified release in the API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API identifier. Must be unique in the current API Management service instance. +// - releaseID - Release identifier within an API. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceAPIReleaseClientDeleteOptions contains the optional parameters for the WorkspaceAPIReleaseClient.Delete +// method. +func (client *WorkspaceAPIReleaseClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, releaseID string, ifMatch string, options *WorkspaceAPIReleaseClientDeleteOptions) (WorkspaceAPIReleaseClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, releaseID, ifMatch, options) + if err != nil { + return WorkspaceAPIReleaseClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIReleaseClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceAPIReleaseClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceAPIReleaseClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceAPIReleaseClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, releaseID string, ifMatch string, options *WorkspaceAPIReleaseClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if releaseID == "" { + return nil, errors.New("parameter releaseID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{releaseId}", url.PathEscape(releaseID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns the details of an API release. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API identifier. Must be unique in the current API Management service instance. +// - releaseID - Release identifier within an API. Must be unique in the current API Management service instance. +// - options - WorkspaceAPIReleaseClientGetOptions contains the optional parameters for the WorkspaceAPIReleaseClient.Get method. +func (client *WorkspaceAPIReleaseClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, releaseID string, options *WorkspaceAPIReleaseClientGetOptions) (WorkspaceAPIReleaseClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, releaseID, options) + if err != nil { + return WorkspaceAPIReleaseClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIReleaseClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIReleaseClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceAPIReleaseClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, releaseID string, options *WorkspaceAPIReleaseClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if releaseID == "" { + return nil, errors.New("parameter releaseID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{releaseId}", url.PathEscape(releaseID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceAPIReleaseClient) getHandleResponse(resp *http.Response) (WorkspaceAPIReleaseClientGetResponse, error) { + result := WorkspaceAPIReleaseClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.APIReleaseContract); err != nil { + return WorkspaceAPIReleaseClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Returns the etag of an API release. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API identifier. Must be unique in the current API Management service instance. +// - releaseID - Release identifier within an API. Must be unique in the current API Management service instance. +// - options - WorkspaceAPIReleaseClientGetEntityTagOptions contains the optional parameters for the WorkspaceAPIReleaseClient.GetEntityTag +// method. +func (client *WorkspaceAPIReleaseClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, releaseID string, options *WorkspaceAPIReleaseClientGetEntityTagOptions) (WorkspaceAPIReleaseClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, releaseID, options) + if err != nil { + return WorkspaceAPIReleaseClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIReleaseClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIReleaseClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspaceAPIReleaseClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, releaseID string, options *WorkspaceAPIReleaseClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if releaseID == "" { + return nil, errors.New("parameter releaseID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{releaseId}", url.PathEscape(releaseID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspaceAPIReleaseClient) getEntityTagHandleResponse(resp *http.Response) (WorkspaceAPIReleaseClientGetEntityTagResponse, error) { + result := WorkspaceAPIReleaseClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByServicePager - Lists all releases of an API. An API release is created when making an API Revision current. Releases +// are also used to rollback to previous revisions. Results will be paged and can be constrained by +// the $top and $skip parameters. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceAPIReleaseClientListByServiceOptions contains the optional parameters for the WorkspaceAPIReleaseClient.NewListByServicePager +// method. +func (client *WorkspaceAPIReleaseClient) NewListByServicePager(resourceGroupName string, serviceName string, workspaceID string, apiID string, options *WorkspaceAPIReleaseClientListByServiceOptions) *runtime.Pager[WorkspaceAPIReleaseClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceAPIReleaseClientListByServiceResponse]{ + More: func(page WorkspaceAPIReleaseClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceAPIReleaseClientListByServiceResponse) (WorkspaceAPIReleaseClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceAPIReleaseClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIReleaseClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIReleaseClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *WorkspaceAPIReleaseClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, options *WorkspaceAPIReleaseClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *WorkspaceAPIReleaseClient) listByServiceHandleResponse(resp *http.Response) (WorkspaceAPIReleaseClientListByServiceResponse, error) { + result := WorkspaceAPIReleaseClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.APIReleaseCollection); err != nil { + return WorkspaceAPIReleaseClientListByServiceResponse{}, err + } + return result, nil +} + +// Update - Updates the details of the release of the API specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API identifier. Must be unique in the current API Management service instance. +// - releaseID - Release identifier within an API. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - API Release Update parameters. +// - options - WorkspaceAPIReleaseClientUpdateOptions contains the optional parameters for the WorkspaceAPIReleaseClient.Update +// method. +func (client *WorkspaceAPIReleaseClient) Update(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, releaseID string, ifMatch string, parameters APIReleaseContract, options *WorkspaceAPIReleaseClientUpdateOptions) (WorkspaceAPIReleaseClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, releaseID, ifMatch, parameters, options) + if err != nil { + return WorkspaceAPIReleaseClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIReleaseClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIReleaseClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *WorkspaceAPIReleaseClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, releaseID string, ifMatch string, parameters APIReleaseContract, options *WorkspaceAPIReleaseClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if releaseID == "" { + return nil, errors.New("parameter releaseID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{releaseId}", url.PathEscape(releaseID)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *WorkspaceAPIReleaseClient) updateHandleResponse(resp *http.Response) (WorkspaceAPIReleaseClientUpdateResponse, error) { + result := WorkspaceAPIReleaseClientUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.APIReleaseContract); err != nil { + return WorkspaceAPIReleaseClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapirevision_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapirevision_client.go new file mode 100644 index 000000000000..2bc89c7c6995 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapirevision_client.go @@ -0,0 +1,135 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceAPIRevisionClient contains the methods for the WorkspaceAPIRevision group. +// Don't use this type directly, use NewWorkspaceAPIRevisionClient() instead. +type WorkspaceAPIRevisionClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceAPIRevisionClient creates a new instance of WorkspaceAPIRevisionClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceAPIRevisionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceAPIRevisionClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceAPIRevisionClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceAPIRevisionClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByServicePager - Lists all revisions of an API. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceAPIRevisionClientListByServiceOptions contains the optional parameters for the WorkspaceAPIRevisionClient.NewListByServicePager +// method. +func (client *WorkspaceAPIRevisionClient) NewListByServicePager(resourceGroupName string, serviceName string, workspaceID string, apiID string, options *WorkspaceAPIRevisionClientListByServiceOptions) *runtime.Pager[WorkspaceAPIRevisionClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceAPIRevisionClientListByServiceResponse]{ + More: func(page WorkspaceAPIRevisionClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceAPIRevisionClientListByServiceResponse) (WorkspaceAPIRevisionClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceAPIRevisionClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIRevisionClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIRevisionClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *WorkspaceAPIRevisionClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, options *WorkspaceAPIRevisionClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/revisions" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *WorkspaceAPIRevisionClient) listByServiceHandleResponse(resp *http.Response) (WorkspaceAPIRevisionClientListByServiceResponse, error) { + result := WorkspaceAPIRevisionClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.APIRevisionCollection); err != nil { + return WorkspaceAPIRevisionClientListByServiceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapischema_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapischema_client.go new file mode 100644 index 000000000000..f80f197115d9 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapischema_client.go @@ -0,0 +1,444 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceAPISchemaClient contains the methods for the WorkspaceAPISchema group. +// Don't use this type directly, use NewWorkspaceAPISchemaClient() instead. +type WorkspaceAPISchemaClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceAPISchemaClient creates a new instance of WorkspaceAPISchemaClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceAPISchemaClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceAPISchemaClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceAPISchemaClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceAPISchemaClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates schema configuration for the API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - schemaID - Schema id identifier. Must be unique in the current API Management service instance. +// - parameters - The schema contents to apply. +// - options - WorkspaceAPISchemaClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkspaceAPISchemaClient.BeginCreateOrUpdate +// method. +func (client *WorkspaceAPISchemaClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, schemaID string, parameters SchemaContract, options *WorkspaceAPISchemaClientBeginCreateOrUpdateOptions) (*runtime.Poller[WorkspaceAPISchemaClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serviceName, workspaceID, apiID, schemaID, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WorkspaceAPISchemaClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WorkspaceAPISchemaClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates schema configuration for the API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +func (client *WorkspaceAPISchemaClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, schemaID string, parameters SchemaContract, options *WorkspaceAPISchemaClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, schemaID, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceAPISchemaClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, schemaID string, parameters SchemaContract, options *WorkspaceAPISchemaClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if schemaID == "" { + return nil, errors.New("parameter schemaID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schemaId}", url.PathEscape(schemaID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// Delete - Deletes the schema configuration at the Api. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - schemaID - Schema id identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceAPISchemaClientDeleteOptions contains the optional parameters for the WorkspaceAPISchemaClient.Delete +// method. +func (client *WorkspaceAPISchemaClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, schemaID string, ifMatch string, options *WorkspaceAPISchemaClientDeleteOptions) (WorkspaceAPISchemaClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, schemaID, ifMatch, options) + if err != nil { + return WorkspaceAPISchemaClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPISchemaClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceAPISchemaClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceAPISchemaClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceAPISchemaClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, schemaID string, ifMatch string, options *WorkspaceAPISchemaClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if schemaID == "" { + return nil, errors.New("parameter schemaID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schemaId}", url.PathEscape(schemaID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Force != nil { + reqQP.Set("force", strconv.FormatBool(*options.Force)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the schema configuration at the API level. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - schemaID - Schema id identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceAPISchemaClientGetOptions contains the optional parameters for the WorkspaceAPISchemaClient.Get method. +func (client *WorkspaceAPISchemaClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, schemaID string, options *WorkspaceAPISchemaClientGetOptions) (WorkspaceAPISchemaClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, schemaID, options) + if err != nil { + return WorkspaceAPISchemaClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPISchemaClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPISchemaClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceAPISchemaClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, schemaID string, options *WorkspaceAPISchemaClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if schemaID == "" { + return nil, errors.New("parameter schemaID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schemaId}", url.PathEscape(schemaID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceAPISchemaClient) getHandleResponse(resp *http.Response) (WorkspaceAPISchemaClientGetResponse, error) { + result := WorkspaceAPISchemaClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.SchemaContract); err != nil { + return WorkspaceAPISchemaClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the schema specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - schemaID - Schema id identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceAPISchemaClientGetEntityTagOptions contains the optional parameters for the WorkspaceAPISchemaClient.GetEntityTag +// method. +func (client *WorkspaceAPISchemaClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, schemaID string, options *WorkspaceAPISchemaClientGetEntityTagOptions) (WorkspaceAPISchemaClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, schemaID, options) + if err != nil { + return WorkspaceAPISchemaClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPISchemaClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPISchemaClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspaceAPISchemaClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, schemaID string, options *WorkspaceAPISchemaClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + if schemaID == "" { + return nil, errors.New("parameter schemaID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schemaId}", url.PathEscape(schemaID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspaceAPISchemaClient) getEntityTagHandleResponse(resp *http.Response) (WorkspaceAPISchemaClientGetEntityTagResponse, error) { + result := WorkspaceAPISchemaClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByAPIPager - Get the schema configuration at the API level. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - apiID - API revision identifier. Must be unique in the current API Management service instance. Non-current revision has +// ;rev=n as a suffix where n is the revision number. +// - options - WorkspaceAPISchemaClientListByAPIOptions contains the optional parameters for the WorkspaceAPISchemaClient.NewListByAPIPager +// method. +func (client *WorkspaceAPISchemaClient) NewListByAPIPager(resourceGroupName string, serviceName string, workspaceID string, apiID string, options *WorkspaceAPISchemaClientListByAPIOptions) *runtime.Pager[WorkspaceAPISchemaClientListByAPIResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceAPISchemaClientListByAPIResponse]{ + More: func(page WorkspaceAPISchemaClientListByAPIResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceAPISchemaClientListByAPIResponse) (WorkspaceAPISchemaClientListByAPIResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByAPICreateRequest(ctx, resourceGroupName, serviceName, workspaceID, apiID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceAPISchemaClientListByAPIResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPISchemaClientListByAPIResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPISchemaClientListByAPIResponse{}, runtime.NewResponseError(resp) + } + return client.listByAPIHandleResponse(resp) + }, + }) +} + +// listByAPICreateRequest creates the ListByAPI request. +func (client *WorkspaceAPISchemaClient) listByAPICreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, apiID string, options *WorkspaceAPISchemaClientListByAPIOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if apiID == "" { + return nil, errors.New("parameter apiID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByAPIHandleResponse handles the ListByAPI response. +func (client *WorkspaceAPISchemaClient) listByAPIHandleResponse(resp *http.Response) (WorkspaceAPISchemaClientListByAPIResponse, error) { + result := WorkspaceAPISchemaClientListByAPIResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SchemaCollection); err != nil { + return WorkspaceAPISchemaClientListByAPIResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapiversionset_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapiversionset_client.go new file mode 100644 index 000000000000..9d971277ad32 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceapiversionset_client.go @@ -0,0 +1,481 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceAPIVersionSetClient contains the methods for the WorkspaceAPIVersionSet group. +// Don't use this type directly, use NewWorkspaceAPIVersionSetClient() instead. +type WorkspaceAPIVersionSetClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceAPIVersionSetClient creates a new instance of WorkspaceAPIVersionSetClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceAPIVersionSetClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceAPIVersionSetClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceAPIVersionSetClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceAPIVersionSetClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or Updates a Api Version Set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - versionSetID - Api Version Set identifier. Must be unique in the current API Management service instance. +// - parameters - Create or update parameters. +// - options - WorkspaceAPIVersionSetClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceAPIVersionSetClient.CreateOrUpdate +// method. +func (client *WorkspaceAPIVersionSetClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, versionSetID string, parameters APIVersionSetContract, options *WorkspaceAPIVersionSetClientCreateOrUpdateOptions) (WorkspaceAPIVersionSetClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, versionSetID, parameters, options) + if err != nil { + return WorkspaceAPIVersionSetClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIVersionSetClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceAPIVersionSetClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceAPIVersionSetClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, versionSetID string, parameters APIVersionSetContract, options *WorkspaceAPIVersionSetClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if versionSetID == "" { + return nil, errors.New("parameter versionSetID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{versionSetId}", url.PathEscape(versionSetID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceAPIVersionSetClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceAPIVersionSetClientCreateOrUpdateResponse, error) { + result := WorkspaceAPIVersionSetClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.APIVersionSetContract); err != nil { + return WorkspaceAPIVersionSetClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes specific Api Version Set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - versionSetID - Api Version Set identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceAPIVersionSetClientDeleteOptions contains the optional parameters for the WorkspaceAPIVersionSetClient.Delete +// method. +func (client *WorkspaceAPIVersionSetClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, versionSetID string, ifMatch string, options *WorkspaceAPIVersionSetClientDeleteOptions) (WorkspaceAPIVersionSetClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, versionSetID, ifMatch, options) + if err != nil { + return WorkspaceAPIVersionSetClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIVersionSetClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceAPIVersionSetClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceAPIVersionSetClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceAPIVersionSetClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, versionSetID string, ifMatch string, options *WorkspaceAPIVersionSetClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if versionSetID == "" { + return nil, errors.New("parameter versionSetID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{versionSetId}", url.PathEscape(versionSetID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the Api Version Set specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - versionSetID - Api Version Set identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceAPIVersionSetClientGetOptions contains the optional parameters for the WorkspaceAPIVersionSetClient.Get +// method. +func (client *WorkspaceAPIVersionSetClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, versionSetID string, options *WorkspaceAPIVersionSetClientGetOptions) (WorkspaceAPIVersionSetClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, versionSetID, options) + if err != nil { + return WorkspaceAPIVersionSetClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIVersionSetClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIVersionSetClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceAPIVersionSetClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, versionSetID string, options *WorkspaceAPIVersionSetClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if versionSetID == "" { + return nil, errors.New("parameter versionSetID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{versionSetId}", url.PathEscape(versionSetID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceAPIVersionSetClient) getHandleResponse(resp *http.Response) (WorkspaceAPIVersionSetClientGetResponse, error) { + result := WorkspaceAPIVersionSetClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.APIVersionSetContract); err != nil { + return WorkspaceAPIVersionSetClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the Api Version Set specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - versionSetID - Api Version Set identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceAPIVersionSetClientGetEntityTagOptions contains the optional parameters for the WorkspaceAPIVersionSetClient.GetEntityTag +// method. +func (client *WorkspaceAPIVersionSetClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, versionSetID string, options *WorkspaceAPIVersionSetClientGetEntityTagOptions) (WorkspaceAPIVersionSetClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, versionSetID, options) + if err != nil { + return WorkspaceAPIVersionSetClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIVersionSetClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIVersionSetClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspaceAPIVersionSetClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, versionSetID string, options *WorkspaceAPIVersionSetClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if versionSetID == "" { + return nil, errors.New("parameter versionSetID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{versionSetId}", url.PathEscape(versionSetID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspaceAPIVersionSetClient) getEntityTagHandleResponse(resp *http.Response) (WorkspaceAPIVersionSetClientGetEntityTagResponse, error) { + result := WorkspaceAPIVersionSetClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByServicePager - Lists a collection of API Version Sets in the specified workspace with a service instance. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceAPIVersionSetClientListByServiceOptions contains the optional parameters for the WorkspaceAPIVersionSetClient.NewListByServicePager +// method. +func (client *WorkspaceAPIVersionSetClient) NewListByServicePager(resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceAPIVersionSetClientListByServiceOptions) *runtime.Pager[WorkspaceAPIVersionSetClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceAPIVersionSetClientListByServiceResponse]{ + More: func(page WorkspaceAPIVersionSetClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceAPIVersionSetClientListByServiceResponse) (WorkspaceAPIVersionSetClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceAPIVersionSetClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIVersionSetClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIVersionSetClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *WorkspaceAPIVersionSetClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceAPIVersionSetClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *WorkspaceAPIVersionSetClient) listByServiceHandleResponse(resp *http.Response) (WorkspaceAPIVersionSetClientListByServiceResponse, error) { + result := WorkspaceAPIVersionSetClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.APIVersionSetCollection); err != nil { + return WorkspaceAPIVersionSetClientListByServiceResponse{}, err + } + return result, nil +} + +// Update - Updates the details of the Api VersionSet specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - versionSetID - Api Version Set identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - Update parameters. +// - options - WorkspaceAPIVersionSetClientUpdateOptions contains the optional parameters for the WorkspaceAPIVersionSetClient.Update +// method. +func (client *WorkspaceAPIVersionSetClient) Update(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, versionSetID string, ifMatch string, parameters APIVersionSetUpdateParameters, options *WorkspaceAPIVersionSetClientUpdateOptions) (WorkspaceAPIVersionSetClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, versionSetID, ifMatch, parameters, options) + if err != nil { + return WorkspaceAPIVersionSetClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceAPIVersionSetClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceAPIVersionSetClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *WorkspaceAPIVersionSetClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, versionSetID string, ifMatch string, parameters APIVersionSetUpdateParameters, options *WorkspaceAPIVersionSetClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if versionSetID == "" { + return nil, errors.New("parameter versionSetID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{versionSetId}", url.PathEscape(versionSetID)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *WorkspaceAPIVersionSetClient) updateHandleResponse(resp *http.Response) (WorkspaceAPIVersionSetClientUpdateResponse, error) { + result := WorkspaceAPIVersionSetClientUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.APIVersionSetContract); err != nil { + return WorkspaceAPIVersionSetClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspaceglobalschema_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceglobalschema_client.go new file mode 100644 index 000000000000..c7c575a04661 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceglobalschema_client.go @@ -0,0 +1,412 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceGlobalSchemaClient contains the methods for the WorkspaceGlobalSchema group. +// Don't use this type directly, use NewWorkspaceGlobalSchemaClient() instead. +type WorkspaceGlobalSchemaClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceGlobalSchemaClient creates a new instance of WorkspaceGlobalSchemaClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceGlobalSchemaClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceGlobalSchemaClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceGlobalSchemaClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceGlobalSchemaClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates new or updates existing specified Schema of the workspace in an API Management service instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - schemaID - Schema id identifier. Must be unique in the current API Management service instance. +// - parameters - Create or update parameters. +// - options - WorkspaceGlobalSchemaClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkspaceGlobalSchemaClient.BeginCreateOrUpdate +// method. +func (client *WorkspaceGlobalSchemaClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, schemaID string, parameters GlobalSchemaContract, options *WorkspaceGlobalSchemaClientBeginCreateOrUpdateOptions) (*runtime.Poller[WorkspaceGlobalSchemaClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serviceName, workspaceID, schemaID, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WorkspaceGlobalSchemaClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WorkspaceGlobalSchemaClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates new or updates existing specified Schema of the workspace in an API Management service instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +func (client *WorkspaceGlobalSchemaClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, schemaID string, parameters GlobalSchemaContract, options *WorkspaceGlobalSchemaClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, schemaID, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceGlobalSchemaClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, schemaID string, parameters GlobalSchemaContract, options *WorkspaceGlobalSchemaClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if schemaID == "" { + return nil, errors.New("parameter schemaID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schemaId}", url.PathEscape(schemaID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// Delete - Deletes specific Schema. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - schemaID - Schema id identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceGlobalSchemaClientDeleteOptions contains the optional parameters for the WorkspaceGlobalSchemaClient.Delete +// method. +func (client *WorkspaceGlobalSchemaClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, schemaID string, ifMatch string, options *WorkspaceGlobalSchemaClientDeleteOptions) (WorkspaceGlobalSchemaClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, schemaID, ifMatch, options) + if err != nil { + return WorkspaceGlobalSchemaClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceGlobalSchemaClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceGlobalSchemaClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceGlobalSchemaClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceGlobalSchemaClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, schemaID string, ifMatch string, options *WorkspaceGlobalSchemaClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if schemaID == "" { + return nil, errors.New("parameter schemaID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schemaId}", url.PathEscape(schemaID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the Schema specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - schemaID - Schema id identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceGlobalSchemaClientGetOptions contains the optional parameters for the WorkspaceGlobalSchemaClient.Get +// method. +func (client *WorkspaceGlobalSchemaClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, schemaID string, options *WorkspaceGlobalSchemaClientGetOptions) (WorkspaceGlobalSchemaClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, schemaID, options) + if err != nil { + return WorkspaceGlobalSchemaClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceGlobalSchemaClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceGlobalSchemaClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceGlobalSchemaClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, schemaID string, options *WorkspaceGlobalSchemaClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if schemaID == "" { + return nil, errors.New("parameter schemaID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schemaId}", url.PathEscape(schemaID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceGlobalSchemaClient) getHandleResponse(resp *http.Response) (WorkspaceGlobalSchemaClientGetResponse, error) { + result := WorkspaceGlobalSchemaClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.GlobalSchemaContract); err != nil { + return WorkspaceGlobalSchemaClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the Schema specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - schemaID - Schema id identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceGlobalSchemaClientGetEntityTagOptions contains the optional parameters for the WorkspaceGlobalSchemaClient.GetEntityTag +// method. +func (client *WorkspaceGlobalSchemaClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, schemaID string, options *WorkspaceGlobalSchemaClientGetEntityTagOptions) (WorkspaceGlobalSchemaClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, schemaID, options) + if err != nil { + return WorkspaceGlobalSchemaClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceGlobalSchemaClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceGlobalSchemaClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspaceGlobalSchemaClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, schemaID string, options *WorkspaceGlobalSchemaClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if schemaID == "" { + return nil, errors.New("parameter schemaID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schemaId}", url.PathEscape(schemaID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspaceGlobalSchemaClient) getEntityTagHandleResponse(resp *http.Response) (WorkspaceGlobalSchemaClientGetEntityTagResponse, error) { + result := WorkspaceGlobalSchemaClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByServicePager - Lists a collection of schemas registered with workspace in a service instance. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceGlobalSchemaClientListByServiceOptions contains the optional parameters for the WorkspaceGlobalSchemaClient.NewListByServicePager +// method. +func (client *WorkspaceGlobalSchemaClient) NewListByServicePager(resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceGlobalSchemaClientListByServiceOptions) *runtime.Pager[WorkspaceGlobalSchemaClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceGlobalSchemaClientListByServiceResponse]{ + More: func(page WorkspaceGlobalSchemaClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceGlobalSchemaClientListByServiceResponse) (WorkspaceGlobalSchemaClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceGlobalSchemaClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceGlobalSchemaClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceGlobalSchemaClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *WorkspaceGlobalSchemaClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceGlobalSchemaClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *WorkspaceGlobalSchemaClient) listByServiceHandleResponse(resp *http.Response) (WorkspaceGlobalSchemaClientListByServiceResponse, error) { + result := WorkspaceGlobalSchemaClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GlobalSchemaCollection); err != nil { + return WorkspaceGlobalSchemaClientListByServiceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspacegroup_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspacegroup_client.go new file mode 100644 index 000000000000..03e147f3afde --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspacegroup_client.go @@ -0,0 +1,478 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceGroupClient contains the methods for the WorkspaceGroup group. +// Don't use this type directly, use NewWorkspaceGroupClient() instead. +type WorkspaceGroupClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceGroupClient creates a new instance of WorkspaceGroupClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceGroupClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceGroupClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceGroupClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or Updates a group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - groupID - Group identifier. Must be unique in the current API Management service instance. +// - parameters - Create parameters. +// - options - WorkspaceGroupClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceGroupClient.CreateOrUpdate +// method. +func (client *WorkspaceGroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, parameters GroupCreateParameters, options *WorkspaceGroupClientCreateOrUpdateOptions) (WorkspaceGroupClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, groupID, parameters, options) + if err != nil { + return WorkspaceGroupClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceGroupClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceGroupClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceGroupClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, parameters GroupCreateParameters, options *WorkspaceGroupClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceGroupClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceGroupClientCreateOrUpdateResponse, error) { + result := WorkspaceGroupClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.GroupContract); err != nil { + return WorkspaceGroupClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes specific group of the workspace in an API Management service instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - groupID - Group identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceGroupClientDeleteOptions contains the optional parameters for the WorkspaceGroupClient.Delete method. +func (client *WorkspaceGroupClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, ifMatch string, options *WorkspaceGroupClientDeleteOptions) (WorkspaceGroupClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, groupID, ifMatch, options) + if err != nil { + return WorkspaceGroupClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceGroupClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceGroupClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceGroupClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceGroupClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, ifMatch string, options *WorkspaceGroupClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the group specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - groupID - Group identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceGroupClientGetOptions contains the optional parameters for the WorkspaceGroupClient.Get method. +func (client *WorkspaceGroupClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, options *WorkspaceGroupClientGetOptions) (WorkspaceGroupClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, groupID, options) + if err != nil { + return WorkspaceGroupClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceGroupClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceGroupClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceGroupClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, options *WorkspaceGroupClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceGroupClient) getHandleResponse(resp *http.Response) (WorkspaceGroupClientGetResponse, error) { + result := WorkspaceGroupClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.GroupContract); err != nil { + return WorkspaceGroupClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the group specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - groupID - Group identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceGroupClientGetEntityTagOptions contains the optional parameters for the WorkspaceGroupClient.GetEntityTag +// method. +func (client *WorkspaceGroupClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, options *WorkspaceGroupClientGetEntityTagOptions) (WorkspaceGroupClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, groupID, options) + if err != nil { + return WorkspaceGroupClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceGroupClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceGroupClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspaceGroupClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, options *WorkspaceGroupClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspaceGroupClient) getEntityTagHandleResponse(resp *http.Response) (WorkspaceGroupClientGetEntityTagResponse, error) { + result := WorkspaceGroupClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByServicePager - Lists a collection of groups defined within a workspace in a service instance. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceGroupClientListByServiceOptions contains the optional parameters for the WorkspaceGroupClient.NewListByServicePager +// method. +func (client *WorkspaceGroupClient) NewListByServicePager(resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceGroupClientListByServiceOptions) *runtime.Pager[WorkspaceGroupClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceGroupClientListByServiceResponse]{ + More: func(page WorkspaceGroupClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceGroupClientListByServiceResponse) (WorkspaceGroupClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceGroupClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceGroupClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceGroupClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *WorkspaceGroupClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceGroupClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *WorkspaceGroupClient) listByServiceHandleResponse(resp *http.Response) (WorkspaceGroupClientListByServiceResponse, error) { + result := WorkspaceGroupClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GroupCollection); err != nil { + return WorkspaceGroupClientListByServiceResponse{}, err + } + return result, nil +} + +// Update - Updates the details of the group specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - groupID - Group identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - Update parameters. +// - options - WorkspaceGroupClientUpdateOptions contains the optional parameters for the WorkspaceGroupClient.Update method. +func (client *WorkspaceGroupClient) Update(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, ifMatch string, parameters GroupUpdateParameters, options *WorkspaceGroupClientUpdateOptions) (WorkspaceGroupClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, groupID, ifMatch, parameters, options) + if err != nil { + return WorkspaceGroupClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceGroupClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceGroupClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *WorkspaceGroupClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, ifMatch string, parameters GroupUpdateParameters, options *WorkspaceGroupClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *WorkspaceGroupClient) updateHandleResponse(resp *http.Response) (WorkspaceGroupClientUpdateResponse, error) { + result := WorkspaceGroupClientUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.GroupContract); err != nil { + return WorkspaceGroupClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspacegroupuser_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspacegroupuser_client.go new file mode 100644 index 000000000000..75ef96c6d70d --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspacegroupuser_client.go @@ -0,0 +1,335 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceGroupUserClient contains the methods for the WorkspaceGroupUser group. +// Don't use this type directly, use NewWorkspaceGroupUserClient() instead. +type WorkspaceGroupUserClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceGroupUserClient creates a new instance of WorkspaceGroupUserClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceGroupUserClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceGroupUserClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceGroupUserClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceGroupUserClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CheckEntityExists - Checks that user entity specified by identifier is associated with the group entity. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - groupID - Group identifier. Must be unique in the current API Management service instance. +// - userID - User identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceGroupUserClientCheckEntityExistsOptions contains the optional parameters for the WorkspaceGroupUserClient.CheckEntityExists +// method. +func (client *WorkspaceGroupUserClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, userID string, options *WorkspaceGroupUserClientCheckEntityExistsOptions) (WorkspaceGroupUserClientCheckEntityExistsResponse, error) { + req, err := client.checkEntityExistsCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, groupID, userID, options) + if err != nil { + return WorkspaceGroupUserClientCheckEntityExistsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceGroupUserClientCheckEntityExistsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { + return WorkspaceGroupUserClientCheckEntityExistsResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceGroupUserClientCheckEntityExistsResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil +} + +// checkEntityExistsCreateRequest creates the CheckEntityExists request. +func (client *WorkspaceGroupUserClient) checkEntityExistsCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, userID string, options *WorkspaceGroupUserClientCheckEntityExistsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + if userID == "" { + return nil, errors.New("parameter userID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{userId}", url.PathEscape(userID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Create - Add existing user to existing group +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - groupID - Group identifier. Must be unique in the current API Management service instance. +// - userID - User identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceGroupUserClientCreateOptions contains the optional parameters for the WorkspaceGroupUserClient.Create +// method. +func (client *WorkspaceGroupUserClient) Create(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, userID string, options *WorkspaceGroupUserClientCreateOptions) (WorkspaceGroupUserClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, groupID, userID, options) + if err != nil { + return WorkspaceGroupUserClientCreateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceGroupUserClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceGroupUserClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *WorkspaceGroupUserClient) createCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, userID string, options *WorkspaceGroupUserClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + if userID == "" { + return nil, errors.New("parameter userID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{userId}", url.PathEscape(userID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *WorkspaceGroupUserClient) createHandleResponse(resp *http.Response) (WorkspaceGroupUserClientCreateResponse, error) { + result := WorkspaceGroupUserClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UserContract); err != nil { + return WorkspaceGroupUserClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Remove existing user from existing group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - groupID - Group identifier. Must be unique in the current API Management service instance. +// - userID - User identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceGroupUserClientDeleteOptions contains the optional parameters for the WorkspaceGroupUserClient.Delete +// method. +func (client *WorkspaceGroupUserClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, userID string, options *WorkspaceGroupUserClientDeleteOptions) (WorkspaceGroupUserClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, groupID, userID, options) + if err != nil { + return WorkspaceGroupUserClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceGroupUserClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceGroupUserClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceGroupUserClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceGroupUserClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, userID string, options *WorkspaceGroupUserClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + if userID == "" { + return nil, errors.New("parameter userID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{userId}", url.PathEscape(userID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// NewListPager - Lists a collection of user entities associated with the group. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - groupID - Group identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceGroupUserClientListOptions contains the optional parameters for the WorkspaceGroupUserClient.NewListPager +// method. +func (client *WorkspaceGroupUserClient) NewListPager(resourceGroupName string, serviceName string, workspaceID string, groupID string, options *WorkspaceGroupUserClientListOptions) *runtime.Pager[WorkspaceGroupUserClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceGroupUserClientListResponse]{ + More: func(page WorkspaceGroupUserClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceGroupUserClientListResponse) (WorkspaceGroupUserClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, groupID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceGroupUserClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceGroupUserClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceGroupUserClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *WorkspaceGroupUserClient) listCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, groupID string, options *WorkspaceGroupUserClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *WorkspaceGroupUserClient) listHandleResponse(resp *http.Response) (WorkspaceGroupUserClientListResponse, error) { + result := WorkspaceGroupUserClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UserCollection); err != nil { + return WorkspaceGroupUserClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspacenamedvalue_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspacenamedvalue_client.go new file mode 100644 index 000000000000..730cfcd5a3f2 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspacenamedvalue_client.go @@ -0,0 +1,643 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceNamedValueClient contains the methods for the WorkspaceNamedValue group. +// Don't use this type directly, use NewWorkspaceNamedValueClient() instead. +type WorkspaceNamedValueClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceNamedValueClient creates a new instance of WorkspaceNamedValueClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceNamedValueClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceNamedValueClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceNamedValueClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceNamedValueClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates named value. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - namedValueID - Identifier of the NamedValue. +// - parameters - Create parameters. +// - options - WorkspaceNamedValueClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkspaceNamedValueClient.BeginCreateOrUpdate +// method. +func (client *WorkspaceNamedValueClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, parameters NamedValueCreateContract, options *WorkspaceNamedValueClientBeginCreateOrUpdateOptions) (*runtime.Poller[WorkspaceNamedValueClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serviceName, workspaceID, namedValueID, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WorkspaceNamedValueClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WorkspaceNamedValueClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates named value. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +func (client *WorkspaceNamedValueClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, parameters NamedValueCreateContract, options *WorkspaceNamedValueClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, namedValueID, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceNamedValueClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, parameters NamedValueCreateContract, options *WorkspaceNamedValueClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if namedValueID == "" { + return nil, errors.New("parameter namedValueID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namedValueId}", url.PathEscape(namedValueID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// Delete - Deletes specific named value from the workspace in an API Management service instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - namedValueID - Identifier of the NamedValue. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceNamedValueClientDeleteOptions contains the optional parameters for the WorkspaceNamedValueClient.Delete +// method. +func (client *WorkspaceNamedValueClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, ifMatch string, options *WorkspaceNamedValueClientDeleteOptions) (WorkspaceNamedValueClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, namedValueID, ifMatch, options) + if err != nil { + return WorkspaceNamedValueClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNamedValueClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceNamedValueClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceNamedValueClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceNamedValueClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, ifMatch string, options *WorkspaceNamedValueClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if namedValueID == "" { + return nil, errors.New("parameter namedValueID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namedValueId}", url.PathEscape(namedValueID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the named value specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - namedValueID - Identifier of the NamedValue. +// - options - WorkspaceNamedValueClientGetOptions contains the optional parameters for the WorkspaceNamedValueClient.Get method. +func (client *WorkspaceNamedValueClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, options *WorkspaceNamedValueClientGetOptions) (WorkspaceNamedValueClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, namedValueID, options) + if err != nil { + return WorkspaceNamedValueClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNamedValueClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceNamedValueClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceNamedValueClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, options *WorkspaceNamedValueClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if namedValueID == "" { + return nil, errors.New("parameter namedValueID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namedValueId}", url.PathEscape(namedValueID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceNamedValueClient) getHandleResponse(resp *http.Response) (WorkspaceNamedValueClientGetResponse, error) { + result := WorkspaceNamedValueClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.NamedValueContract); err != nil { + return WorkspaceNamedValueClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the named value specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - namedValueID - Identifier of the NamedValue. +// - options - WorkspaceNamedValueClientGetEntityTagOptions contains the optional parameters for the WorkspaceNamedValueClient.GetEntityTag +// method. +func (client *WorkspaceNamedValueClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, options *WorkspaceNamedValueClientGetEntityTagOptions) (WorkspaceNamedValueClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, namedValueID, options) + if err != nil { + return WorkspaceNamedValueClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNamedValueClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceNamedValueClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspaceNamedValueClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, options *WorkspaceNamedValueClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if namedValueID == "" { + return nil, errors.New("parameter namedValueID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namedValueId}", url.PathEscape(namedValueID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspaceNamedValueClient) getEntityTagHandleResponse(resp *http.Response) (WorkspaceNamedValueClientGetEntityTagResponse, error) { + result := WorkspaceNamedValueClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByServicePager - Lists a collection of named values defined within a workspace in a service instance. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceNamedValueClientListByServiceOptions contains the optional parameters for the WorkspaceNamedValueClient.NewListByServicePager +// method. +func (client *WorkspaceNamedValueClient) NewListByServicePager(resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceNamedValueClientListByServiceOptions) *runtime.Pager[WorkspaceNamedValueClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceNamedValueClientListByServiceResponse]{ + More: func(page WorkspaceNamedValueClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceNamedValueClientListByServiceResponse) (WorkspaceNamedValueClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceNamedValueClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNamedValueClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceNamedValueClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *WorkspaceNamedValueClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceNamedValueClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.IsKeyVaultRefreshFailed != nil { + reqQP.Set("isKeyVaultRefreshFailed", string(*options.IsKeyVaultRefreshFailed)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *WorkspaceNamedValueClient) listByServiceHandleResponse(resp *http.Response) (WorkspaceNamedValueClientListByServiceResponse, error) { + result := WorkspaceNamedValueClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NamedValueCollection); err != nil { + return WorkspaceNamedValueClientListByServiceResponse{}, err + } + return result, nil +} + +// ListValue - Gets the secret of the named value specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - namedValueID - Identifier of the NamedValue. +// - options - WorkspaceNamedValueClientListValueOptions contains the optional parameters for the WorkspaceNamedValueClient.ListValue +// method. +func (client *WorkspaceNamedValueClient) ListValue(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, options *WorkspaceNamedValueClientListValueOptions) (WorkspaceNamedValueClientListValueResponse, error) { + req, err := client.listValueCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, namedValueID, options) + if err != nil { + return WorkspaceNamedValueClientListValueResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNamedValueClientListValueResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceNamedValueClientListValueResponse{}, runtime.NewResponseError(resp) + } + return client.listValueHandleResponse(resp) +} + +// listValueCreateRequest creates the ListValue request. +func (client *WorkspaceNamedValueClient) listValueCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, options *WorkspaceNamedValueClientListValueOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/listValue" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if namedValueID == "" { + return nil, errors.New("parameter namedValueID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namedValueId}", url.PathEscape(namedValueID)) + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listValueHandleResponse handles the ListValue response. +func (client *WorkspaceNamedValueClient) listValueHandleResponse(resp *http.Response) (WorkspaceNamedValueClientListValueResponse, error) { + result := WorkspaceNamedValueClientListValueResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.NamedValueSecretContract); err != nil { + return WorkspaceNamedValueClientListValueResponse{}, err + } + return result, nil +} + +// BeginRefreshSecret - Refresh the secret of the named value specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - namedValueID - Identifier of the NamedValue. +// - options - WorkspaceNamedValueClientBeginRefreshSecretOptions contains the optional parameters for the WorkspaceNamedValueClient.BeginRefreshSecret +// method. +func (client *WorkspaceNamedValueClient) BeginRefreshSecret(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, options *WorkspaceNamedValueClientBeginRefreshSecretOptions) (*runtime.Poller[WorkspaceNamedValueClientRefreshSecretResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.refreshSecret(ctx, resourceGroupName, serviceName, workspaceID, namedValueID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WorkspaceNamedValueClientRefreshSecretResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WorkspaceNamedValueClientRefreshSecretResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// RefreshSecret - Refresh the secret of the named value specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +func (client *WorkspaceNamedValueClient) refreshSecret(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, options *WorkspaceNamedValueClientBeginRefreshSecretOptions) (*http.Response, error) { + req, err := client.refreshSecretCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, namedValueID, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// refreshSecretCreateRequest creates the RefreshSecret request. +func (client *WorkspaceNamedValueClient) refreshSecretCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, options *WorkspaceNamedValueClientBeginRefreshSecretOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/refreshSecret" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if namedValueID == "" { + return nil, errors.New("parameter namedValueID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namedValueId}", url.PathEscape(namedValueID)) + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Updates the specific named value. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - namedValueID - Identifier of the NamedValue. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - Update parameters. +// - options - WorkspaceNamedValueClientBeginUpdateOptions contains the optional parameters for the WorkspaceNamedValueClient.BeginUpdate +// method. +func (client *WorkspaceNamedValueClient) BeginUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, ifMatch string, parameters NamedValueUpdateParameters, options *WorkspaceNamedValueClientBeginUpdateOptions) (*runtime.Poller[WorkspaceNamedValueClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, serviceName, workspaceID, namedValueID, ifMatch, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WorkspaceNamedValueClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WorkspaceNamedValueClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - Updates the specific named value. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +func (client *WorkspaceNamedValueClient) update(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, ifMatch string, parameters NamedValueUpdateParameters, options *WorkspaceNamedValueClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, namedValueID, ifMatch, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *WorkspaceNamedValueClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, namedValueID string, ifMatch string, parameters NamedValueUpdateParameters, options *WorkspaceNamedValueClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if namedValueID == "" { + return nil, errors.New("parameter namedValueID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namedValueId}", url.PathEscape(namedValueID)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspacenotification_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspacenotification_client.go new file mode 100644 index 000000000000..90c552b2906f --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspacenotification_client.go @@ -0,0 +1,266 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceNotificationClient contains the methods for the WorkspaceNotification group. +// Don't use this type directly, use NewWorkspaceNotificationClient() instead. +type WorkspaceNotificationClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceNotificationClient creates a new instance of WorkspaceNotificationClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceNotificationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceNotificationClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceNotificationClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceNotificationClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create or Update API Management publisher notification for the workspace. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - notificationName - Notification Name Identifier. +// - options - WorkspaceNotificationClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceNotificationClient.CreateOrUpdate +// method. +func (client *WorkspaceNotificationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, options *WorkspaceNotificationClientCreateOrUpdateOptions) (WorkspaceNotificationClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, notificationName, options) + if err != nil { + return WorkspaceNotificationClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNotificationClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceNotificationClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceNotificationClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, options *WorkspaceNotificationClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if notificationName == "" { + return nil, errors.New("parameter notificationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{notificationName}", url.PathEscape(string(notificationName))) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceNotificationClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceNotificationClientCreateOrUpdateResponse, error) { + result := WorkspaceNotificationClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NotificationContract); err != nil { + return WorkspaceNotificationClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Get - Gets the details of the Notification specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - notificationName - Notification Name Identifier. +// - options - WorkspaceNotificationClientGetOptions contains the optional parameters for the WorkspaceNotificationClient.Get +// method. +func (client *WorkspaceNotificationClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, options *WorkspaceNotificationClientGetOptions) (WorkspaceNotificationClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, notificationName, options) + if err != nil { + return WorkspaceNotificationClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNotificationClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceNotificationClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceNotificationClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, options *WorkspaceNotificationClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if notificationName == "" { + return nil, errors.New("parameter notificationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{notificationName}", url.PathEscape(string(notificationName))) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceNotificationClient) getHandleResponse(resp *http.Response) (WorkspaceNotificationClientGetResponse, error) { + result := WorkspaceNotificationClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NotificationContract); err != nil { + return WorkspaceNotificationClientGetResponse{}, err + } + return result, nil +} + +// NewListByServicePager - Lists a collection of properties defined within a service instance. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceNotificationClientListByServiceOptions contains the optional parameters for the WorkspaceNotificationClient.NewListByServicePager +// method. +func (client *WorkspaceNotificationClient) NewListByServicePager(resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceNotificationClientListByServiceOptions) *runtime.Pager[WorkspaceNotificationClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceNotificationClientListByServiceResponse]{ + More: func(page WorkspaceNotificationClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceNotificationClientListByServiceResponse) (WorkspaceNotificationClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceNotificationClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNotificationClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceNotificationClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *WorkspaceNotificationClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceNotificationClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *WorkspaceNotificationClient) listByServiceHandleResponse(resp *http.Response) (WorkspaceNotificationClientListByServiceResponse, error) { + result := WorkspaceNotificationClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NotificationCollection); err != nil { + return WorkspaceNotificationClientListByServiceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspacenotificationrecipientemail_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspacenotificationrecipientemail_client.go new file mode 100644 index 000000000000..6601f36e4c4f --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspacenotificationrecipientemail_client.go @@ -0,0 +1,313 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WorkspaceNotificationRecipientEmailClient contains the methods for the WorkspaceNotificationRecipientEmail group. +// Don't use this type directly, use NewWorkspaceNotificationRecipientEmailClient() instead. +type WorkspaceNotificationRecipientEmailClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceNotificationRecipientEmailClient creates a new instance of WorkspaceNotificationRecipientEmailClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceNotificationRecipientEmailClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceNotificationRecipientEmailClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceNotificationRecipientEmailClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceNotificationRecipientEmailClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CheckEntityExists - Determine if Notification Recipient Email subscribed to the notification. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - notificationName - Notification Name Identifier. +// - email - Email identifier. +// - options - WorkspaceNotificationRecipientEmailClientCheckEntityExistsOptions contains the optional parameters for the WorkspaceNotificationRecipientEmailClient.CheckEntityExists +// method. +func (client *WorkspaceNotificationRecipientEmailClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, email string, options *WorkspaceNotificationRecipientEmailClientCheckEntityExistsOptions) (WorkspaceNotificationRecipientEmailClientCheckEntityExistsResponse, error) { + req, err := client.checkEntityExistsCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, notificationName, email, options) + if err != nil { + return WorkspaceNotificationRecipientEmailClientCheckEntityExistsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNotificationRecipientEmailClientCheckEntityExistsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { + return WorkspaceNotificationRecipientEmailClientCheckEntityExistsResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceNotificationRecipientEmailClientCheckEntityExistsResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil +} + +// checkEntityExistsCreateRequest creates the CheckEntityExists request. +func (client *WorkspaceNotificationRecipientEmailClient) checkEntityExistsCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, email string, options *WorkspaceNotificationRecipientEmailClientCheckEntityExistsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if notificationName == "" { + return nil, errors.New("parameter notificationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{notificationName}", url.PathEscape(string(notificationName))) + if email == "" { + return nil, errors.New("parameter email cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{email}", url.PathEscape(email)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CreateOrUpdate - Adds the Email address to the list of Recipients for the Notification. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - notificationName - Notification Name Identifier. +// - email - Email identifier. +// - options - WorkspaceNotificationRecipientEmailClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceNotificationRecipientEmailClient.CreateOrUpdate +// method. +func (client *WorkspaceNotificationRecipientEmailClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, email string, options *WorkspaceNotificationRecipientEmailClientCreateOrUpdateOptions) (WorkspaceNotificationRecipientEmailClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, notificationName, email, options) + if err != nil { + return WorkspaceNotificationRecipientEmailClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNotificationRecipientEmailClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceNotificationRecipientEmailClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceNotificationRecipientEmailClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, email string, options *WorkspaceNotificationRecipientEmailClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if notificationName == "" { + return nil, errors.New("parameter notificationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{notificationName}", url.PathEscape(string(notificationName))) + if email == "" { + return nil, errors.New("parameter email cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{email}", url.PathEscape(email)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceNotificationRecipientEmailClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceNotificationRecipientEmailClientCreateOrUpdateResponse, error) { + result := WorkspaceNotificationRecipientEmailClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecipientEmailContract); err != nil { + return WorkspaceNotificationRecipientEmailClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Removes the email from the list of Notification. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - notificationName - Notification Name Identifier. +// - email - Email identifier. +// - options - WorkspaceNotificationRecipientEmailClientDeleteOptions contains the optional parameters for the WorkspaceNotificationRecipientEmailClient.Delete +// method. +func (client *WorkspaceNotificationRecipientEmailClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, email string, options *WorkspaceNotificationRecipientEmailClientDeleteOptions) (WorkspaceNotificationRecipientEmailClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, notificationName, email, options) + if err != nil { + return WorkspaceNotificationRecipientEmailClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNotificationRecipientEmailClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceNotificationRecipientEmailClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceNotificationRecipientEmailClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceNotificationRecipientEmailClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, email string, options *WorkspaceNotificationRecipientEmailClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if notificationName == "" { + return nil, errors.New("parameter notificationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{notificationName}", url.PathEscape(string(notificationName))) + if email == "" { + return nil, errors.New("parameter email cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{email}", url.PathEscape(email)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// ListByNotification - Gets the list of the Notification Recipient Emails subscribed to a notification. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - notificationName - Notification Name Identifier. +// - options - WorkspaceNotificationRecipientEmailClientListByNotificationOptions contains the optional parameters for the WorkspaceNotificationRecipientEmailClient.ListByNotification +// method. +func (client *WorkspaceNotificationRecipientEmailClient) ListByNotification(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, options *WorkspaceNotificationRecipientEmailClientListByNotificationOptions) (WorkspaceNotificationRecipientEmailClientListByNotificationResponse, error) { + req, err := client.listByNotificationCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, notificationName, options) + if err != nil { + return WorkspaceNotificationRecipientEmailClientListByNotificationResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNotificationRecipientEmailClientListByNotificationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceNotificationRecipientEmailClientListByNotificationResponse{}, runtime.NewResponseError(resp) + } + return client.listByNotificationHandleResponse(resp) +} + +// listByNotificationCreateRequest creates the ListByNotification request. +func (client *WorkspaceNotificationRecipientEmailClient) listByNotificationCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, options *WorkspaceNotificationRecipientEmailClientListByNotificationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if notificationName == "" { + return nil, errors.New("parameter notificationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{notificationName}", url.PathEscape(string(notificationName))) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByNotificationHandleResponse handles the ListByNotification response. +func (client *WorkspaceNotificationRecipientEmailClient) listByNotificationHandleResponse(resp *http.Response) (WorkspaceNotificationRecipientEmailClientListByNotificationResponse, error) { + result := WorkspaceNotificationRecipientEmailClientListByNotificationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecipientEmailCollection); err != nil { + return WorkspaceNotificationRecipientEmailClientListByNotificationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspacenotificationrecipientuser_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspacenotificationrecipientuser_client.go new file mode 100644 index 000000000000..2581ba31ccfa --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspacenotificationrecipientuser_client.go @@ -0,0 +1,313 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WorkspaceNotificationRecipientUserClient contains the methods for the WorkspaceNotificationRecipientUser group. +// Don't use this type directly, use NewWorkspaceNotificationRecipientUserClient() instead. +type WorkspaceNotificationRecipientUserClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceNotificationRecipientUserClient creates a new instance of WorkspaceNotificationRecipientUserClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceNotificationRecipientUserClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceNotificationRecipientUserClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceNotificationRecipientUserClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceNotificationRecipientUserClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CheckEntityExists - Determine if the Notification Recipient User is subscribed to the notification. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - notificationName - Notification Name Identifier. +// - userID - User identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceNotificationRecipientUserClientCheckEntityExistsOptions contains the optional parameters for the WorkspaceNotificationRecipientUserClient.CheckEntityExists +// method. +func (client *WorkspaceNotificationRecipientUserClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, userID string, options *WorkspaceNotificationRecipientUserClientCheckEntityExistsOptions) (WorkspaceNotificationRecipientUserClientCheckEntityExistsResponse, error) { + req, err := client.checkEntityExistsCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, notificationName, userID, options) + if err != nil { + return WorkspaceNotificationRecipientUserClientCheckEntityExistsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNotificationRecipientUserClientCheckEntityExistsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { + return WorkspaceNotificationRecipientUserClientCheckEntityExistsResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceNotificationRecipientUserClientCheckEntityExistsResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil +} + +// checkEntityExistsCreateRequest creates the CheckEntityExists request. +func (client *WorkspaceNotificationRecipientUserClient) checkEntityExistsCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, userID string, options *WorkspaceNotificationRecipientUserClientCheckEntityExistsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if notificationName == "" { + return nil, errors.New("parameter notificationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{notificationName}", url.PathEscape(string(notificationName))) + if userID == "" { + return nil, errors.New("parameter userID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{userId}", url.PathEscape(userID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CreateOrUpdate - Adds the API Management User to the list of Recipients for the Notification. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - notificationName - Notification Name Identifier. +// - userID - User identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceNotificationRecipientUserClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceNotificationRecipientUserClient.CreateOrUpdate +// method. +func (client *WorkspaceNotificationRecipientUserClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, userID string, options *WorkspaceNotificationRecipientUserClientCreateOrUpdateOptions) (WorkspaceNotificationRecipientUserClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, notificationName, userID, options) + if err != nil { + return WorkspaceNotificationRecipientUserClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNotificationRecipientUserClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceNotificationRecipientUserClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceNotificationRecipientUserClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, userID string, options *WorkspaceNotificationRecipientUserClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if notificationName == "" { + return nil, errors.New("parameter notificationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{notificationName}", url.PathEscape(string(notificationName))) + if userID == "" { + return nil, errors.New("parameter userID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{userId}", url.PathEscape(userID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceNotificationRecipientUserClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceNotificationRecipientUserClientCreateOrUpdateResponse, error) { + result := WorkspaceNotificationRecipientUserClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecipientUserContract); err != nil { + return WorkspaceNotificationRecipientUserClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Removes the API Management user from the list of Notification. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - notificationName - Notification Name Identifier. +// - userID - User identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceNotificationRecipientUserClientDeleteOptions contains the optional parameters for the WorkspaceNotificationRecipientUserClient.Delete +// method. +func (client *WorkspaceNotificationRecipientUserClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, userID string, options *WorkspaceNotificationRecipientUserClientDeleteOptions) (WorkspaceNotificationRecipientUserClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, notificationName, userID, options) + if err != nil { + return WorkspaceNotificationRecipientUserClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNotificationRecipientUserClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceNotificationRecipientUserClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceNotificationRecipientUserClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceNotificationRecipientUserClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, userID string, options *WorkspaceNotificationRecipientUserClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if notificationName == "" { + return nil, errors.New("parameter notificationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{notificationName}", url.PathEscape(string(notificationName))) + if userID == "" { + return nil, errors.New("parameter userID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{userId}", url.PathEscape(userID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// ListByNotification - Gets the list of the Notification Recipient User subscribed to the notification. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - notificationName - Notification Name Identifier. +// - options - WorkspaceNotificationRecipientUserClientListByNotificationOptions contains the optional parameters for the WorkspaceNotificationRecipientUserClient.ListByNotification +// method. +func (client *WorkspaceNotificationRecipientUserClient) ListByNotification(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, options *WorkspaceNotificationRecipientUserClientListByNotificationOptions) (WorkspaceNotificationRecipientUserClientListByNotificationResponse, error) { + req, err := client.listByNotificationCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, notificationName, options) + if err != nil { + return WorkspaceNotificationRecipientUserClientListByNotificationResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceNotificationRecipientUserClientListByNotificationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceNotificationRecipientUserClientListByNotificationResponse{}, runtime.NewResponseError(resp) + } + return client.listByNotificationHandleResponse(resp) +} + +// listByNotificationCreateRequest creates the ListByNotification request. +func (client *WorkspaceNotificationRecipientUserClient) listByNotificationCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, notificationName NotificationName, options *WorkspaceNotificationRecipientUserClientListByNotificationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if notificationName == "" { + return nil, errors.New("parameter notificationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{notificationName}", url.PathEscape(string(notificationName))) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByNotificationHandleResponse handles the ListByNotification response. +func (client *WorkspaceNotificationRecipientUserClient) listByNotificationHandleResponse(resp *http.Response) (WorkspaceNotificationRecipientUserClientListByNotificationResponse, error) { + result := WorkspaceNotificationRecipientUserClientListByNotificationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecipientUserCollection); err != nil { + return WorkspaceNotificationRecipientUserClientListByNotificationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspacepolicy_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspacepolicy_client.go new file mode 100644 index 000000000000..af695d4251d6 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspacepolicy_client.go @@ -0,0 +1,397 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WorkspacePolicyClient contains the methods for the WorkspacePolicy group. +// Don't use this type directly, use NewWorkspacePolicyClient() instead. +type WorkspacePolicyClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspacePolicyClient creates a new instance of WorkspacePolicyClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspacePolicyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspacePolicyClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspacePolicyClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspacePolicyClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates policy configuration for the workspace. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - parameters - The policy contents to apply. +// - options - WorkspacePolicyClientCreateOrUpdateOptions contains the optional parameters for the WorkspacePolicyClient.CreateOrUpdate +// method. +func (client *WorkspacePolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, policyID PolicyIDName, parameters PolicyContract, options *WorkspacePolicyClientCreateOrUpdateOptions) (WorkspacePolicyClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, policyID, parameters, options) + if err != nil { + return WorkspacePolicyClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspacePolicyClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspacePolicyClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspacePolicyClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, policyID PolicyIDName, parameters PolicyContract, options *WorkspacePolicyClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspacePolicyClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspacePolicyClientCreateOrUpdateResponse, error) { + result := WorkspacePolicyClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { + return WorkspacePolicyClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the policy configuration at the workspace. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspacePolicyClientDeleteOptions contains the optional parameters for the WorkspacePolicyClient.Delete method. +func (client *WorkspacePolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, policyID PolicyIDName, ifMatch string, options *WorkspacePolicyClientDeleteOptions) (WorkspacePolicyClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, policyID, ifMatch, options) + if err != nil { + return WorkspacePolicyClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspacePolicyClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspacePolicyClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspacePolicyClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspacePolicyClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, policyID PolicyIDName, ifMatch string, options *WorkspacePolicyClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the policy configuration at the API level. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - options - WorkspacePolicyClientGetOptions contains the optional parameters for the WorkspacePolicyClient.Get method. +func (client *WorkspacePolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, policyID PolicyIDName, options *WorkspacePolicyClientGetOptions) (WorkspacePolicyClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, policyID, options) + if err != nil { + return WorkspacePolicyClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspacePolicyClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspacePolicyClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspacePolicyClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, policyID PolicyIDName, options *WorkspacePolicyClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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() + if options != nil && options.Format != nil { + reqQP.Set("format", string(*options.Format)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspacePolicyClient) getHandleResponse(resp *http.Response) (WorkspacePolicyClientGetResponse, error) { + result := WorkspacePolicyClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { + return WorkspacePolicyClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the workspace policy specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - options - WorkspacePolicyClientGetEntityTagOptions contains the optional parameters for the WorkspacePolicyClient.GetEntityTag +// method. +func (client *WorkspacePolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, policyID PolicyIDName, options *WorkspacePolicyClientGetEntityTagOptions) (WorkspacePolicyClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, policyID, options) + if err != nil { + return WorkspacePolicyClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspacePolicyClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspacePolicyClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspacePolicyClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, policyID PolicyIDName, options *WorkspacePolicyClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspacePolicyClient) getEntityTagHandleResponse(resp *http.Response) (WorkspacePolicyClientGetEntityTagResponse, error) { + result := WorkspacePolicyClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByAPIPager - Get the policy configuration at the workspace level. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - options - WorkspacePolicyClientListByAPIOptions contains the optional parameters for the WorkspacePolicyClient.NewListByAPIPager +// method. +func (client *WorkspacePolicyClient) NewListByAPIPager(resourceGroupName string, serviceName string, workspaceID string, options *WorkspacePolicyClientListByAPIOptions) *runtime.Pager[WorkspacePolicyClientListByAPIResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspacePolicyClientListByAPIResponse]{ + More: func(page WorkspacePolicyClientListByAPIResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspacePolicyClientListByAPIResponse) (WorkspacePolicyClientListByAPIResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByAPICreateRequest(ctx, resourceGroupName, serviceName, workspaceID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspacePolicyClientListByAPIResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspacePolicyClientListByAPIResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspacePolicyClientListByAPIResponse{}, runtime.NewResponseError(resp) + } + return client.listByAPIHandleResponse(resp) + }, + }) +} + +// listByAPICreateRequest creates the ListByAPI request. +func (client *WorkspacePolicyClient) listByAPICreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspacePolicyClientListByAPIOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByAPIHandleResponse handles the ListByAPI response. +func (client *WorkspacePolicyClient) listByAPIHandleResponse(resp *http.Response) (WorkspacePolicyClientListByAPIResponse, error) { + result := WorkspacePolicyClientListByAPIResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyCollection); err != nil { + return WorkspacePolicyClientListByAPIResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspacepolicyfragment_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspacepolicyfragment_client.go new file mode 100644 index 000000000000..d5b2b34ea2d6 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspacepolicyfragment_client.go @@ -0,0 +1,492 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspacePolicyFragmentClient contains the methods for the WorkspacePolicyFragment group. +// Don't use this type directly, use NewWorkspacePolicyFragmentClient() instead. +type WorkspacePolicyFragmentClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspacePolicyFragmentClient creates a new instance of WorkspacePolicyFragmentClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspacePolicyFragmentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspacePolicyFragmentClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspacePolicyFragmentClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspacePolicyFragmentClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a policy fragment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - id - A resource identifier. +// - parameters - The policy fragment contents to apply. +// - options - WorkspacePolicyFragmentClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkspacePolicyFragmentClient.BeginCreateOrUpdate +// method. +func (client *WorkspacePolicyFragmentClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, id string, parameters PolicyFragmentContract, options *WorkspacePolicyFragmentClientBeginCreateOrUpdateOptions) (*runtime.Poller[WorkspacePolicyFragmentClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serviceName, workspaceID, id, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WorkspacePolicyFragmentClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WorkspacePolicyFragmentClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates a policy fragment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +func (client *WorkspacePolicyFragmentClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, id string, parameters PolicyFragmentContract, options *WorkspacePolicyFragmentClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, id, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspacePolicyFragmentClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, id string, parameters PolicyFragmentContract, options *WorkspacePolicyFragmentClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// Delete - Deletes a policy fragment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - id - A resource identifier. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspacePolicyFragmentClientDeleteOptions contains the optional parameters for the WorkspacePolicyFragmentClient.Delete +// method. +func (client *WorkspacePolicyFragmentClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, id string, ifMatch string, options *WorkspacePolicyFragmentClientDeleteOptions) (WorkspacePolicyFragmentClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, id, ifMatch, options) + if err != nil { + return WorkspacePolicyFragmentClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspacePolicyFragmentClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspacePolicyFragmentClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspacePolicyFragmentClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspacePolicyFragmentClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, id string, ifMatch string, options *WorkspacePolicyFragmentClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a policy fragment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - id - A resource identifier. +// - options - WorkspacePolicyFragmentClientGetOptions contains the optional parameters for the WorkspacePolicyFragmentClient.Get +// method. +func (client *WorkspacePolicyFragmentClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, id string, options *WorkspacePolicyFragmentClientGetOptions) (WorkspacePolicyFragmentClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, id, options) + if err != nil { + return WorkspacePolicyFragmentClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspacePolicyFragmentClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspacePolicyFragmentClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspacePolicyFragmentClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, id string, options *WorkspacePolicyFragmentClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + 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", "2023-03-01-preview") + if options != nil && options.Format != nil { + reqQP.Set("format", string(*options.Format)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspacePolicyFragmentClient) getHandleResponse(resp *http.Response) (WorkspacePolicyFragmentClientGetResponse, error) { + result := WorkspacePolicyFragmentClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyFragmentContract); err != nil { + return WorkspacePolicyFragmentClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of a policy fragment. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - id - A resource identifier. +// - options - WorkspacePolicyFragmentClientGetEntityTagOptions contains the optional parameters for the WorkspacePolicyFragmentClient.GetEntityTag +// method. +func (client *WorkspacePolicyFragmentClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, id string, options *WorkspacePolicyFragmentClientGetEntityTagOptions) (WorkspacePolicyFragmentClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, id, options) + if err != nil { + return WorkspacePolicyFragmentClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspacePolicyFragmentClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspacePolicyFragmentClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspacePolicyFragmentClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, id string, options *WorkspacePolicyFragmentClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspacePolicyFragmentClient) getEntityTagHandleResponse(resp *http.Response) (WorkspacePolicyFragmentClientGetEntityTagResponse, error) { + result := WorkspacePolicyFragmentClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByServicePager - Gets all policy fragments defined within a workspace. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - options - WorkspacePolicyFragmentClientListByServiceOptions contains the optional parameters for the WorkspacePolicyFragmentClient.NewListByServicePager +// method. +func (client *WorkspacePolicyFragmentClient) NewListByServicePager(resourceGroupName string, serviceName string, workspaceID string, options *WorkspacePolicyFragmentClientListByServiceOptions) *runtime.Pager[WorkspacePolicyFragmentClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspacePolicyFragmentClientListByServiceResponse]{ + More: func(page WorkspacePolicyFragmentClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspacePolicyFragmentClientListByServiceResponse) (WorkspacePolicyFragmentClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspacePolicyFragmentClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspacePolicyFragmentClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspacePolicyFragmentClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *WorkspacePolicyFragmentClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspacePolicyFragmentClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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", "2023-03-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *WorkspacePolicyFragmentClient) listByServiceHandleResponse(resp *http.Response) (WorkspacePolicyFragmentClientListByServiceResponse, error) { + result := WorkspacePolicyFragmentClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyFragmentCollection); err != nil { + return WorkspacePolicyFragmentClientListByServiceResponse{}, err + } + return result, nil +} + +// ListReferences - Lists policy resources that reference the policy fragment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - id - A resource identifier. +// - options - WorkspacePolicyFragmentClientListReferencesOptions contains the optional parameters for the WorkspacePolicyFragmentClient.ListReferences +// method. +func (client *WorkspacePolicyFragmentClient) ListReferences(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, id string, options *WorkspacePolicyFragmentClientListReferencesOptions) (WorkspacePolicyFragmentClientListReferencesResponse, error) { + req, err := client.listReferencesCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, id, options) + if err != nil { + return WorkspacePolicyFragmentClientListReferencesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspacePolicyFragmentClientListReferencesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspacePolicyFragmentClientListReferencesResponse{}, runtime.NewResponseError(resp) + } + return client.listReferencesHandleResponse(resp) +} + +// listReferencesCreateRequest creates the ListReferences request. +func (client *WorkspacePolicyFragmentClient) listReferencesCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, id string, options *WorkspacePolicyFragmentClientListReferencesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}/listReferences" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listReferencesHandleResponse handles the ListReferences response. +func (client *WorkspacePolicyFragmentClient) listReferencesHandleResponse(resp *http.Response) (WorkspacePolicyFragmentClientListReferencesResponse, error) { + result := WorkspacePolicyFragmentClientListReferencesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceCollection); err != nil { + return WorkspacePolicyFragmentClientListReferencesResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspaceproduct_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceproduct_client.go new file mode 100644 index 000000000000..7f611e1733a6 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceproduct_client.go @@ -0,0 +1,487 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceProductClient contains the methods for the WorkspaceProduct group. +// Don't use this type directly, use NewWorkspaceProductClient() instead. +type WorkspaceProductClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceProductClient creates a new instance of WorkspaceProductClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceProductClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceProductClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceProductClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceProductClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or Updates a product. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - parameters - Create or update parameters. +// - options - WorkspaceProductClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceProductClient.CreateOrUpdate +// method. +func (client *WorkspaceProductClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, parameters ProductContract, options *WorkspaceProductClientCreateOrUpdateOptions) (WorkspaceProductClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, parameters, options) + if err != nil { + return WorkspaceProductClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceProductClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceProductClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, parameters ProductContract, options *WorkspaceProductClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceProductClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceProductClientCreateOrUpdateResponse, error) { + result := WorkspaceProductClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ProductContract); err != nil { + return WorkspaceProductClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete product. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceProductClientDeleteOptions contains the optional parameters for the WorkspaceProductClient.Delete method. +func (client *WorkspaceProductClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, ifMatch string, options *WorkspaceProductClientDeleteOptions) (WorkspaceProductClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, ifMatch, options) + if err != nil { + return WorkspaceProductClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceProductClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceProductClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceProductClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, ifMatch string, options *WorkspaceProductClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.DeleteSubscriptions != nil { + reqQP.Set("deleteSubscriptions", strconv.FormatBool(*options.DeleteSubscriptions)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the product specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceProductClientGetOptions contains the optional parameters for the WorkspaceProductClient.Get method. +func (client *WorkspaceProductClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, options *WorkspaceProductClientGetOptions) (WorkspaceProductClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, options) + if err != nil { + return WorkspaceProductClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceProductClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceProductClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, options *WorkspaceProductClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceProductClient) getHandleResponse(resp *http.Response) (WorkspaceProductClientGetResponse, error) { + result := WorkspaceProductClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ProductContract); err != nil { + return WorkspaceProductClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the product specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceProductClientGetEntityTagOptions contains the optional parameters for the WorkspaceProductClient.GetEntityTag +// method. +func (client *WorkspaceProductClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, options *WorkspaceProductClientGetEntityTagOptions) (WorkspaceProductClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, options) + if err != nil { + return WorkspaceProductClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceProductClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspaceProductClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, options *WorkspaceProductClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspaceProductClient) getEntityTagHandleResponse(resp *http.Response) (WorkspaceProductClientGetEntityTagResponse, error) { + result := WorkspaceProductClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByServicePager - Lists a collection of products in the specified workspace in a service instance. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceProductClientListByServiceOptions contains the optional parameters for the WorkspaceProductClient.NewListByServicePager +// method. +func (client *WorkspaceProductClient) NewListByServicePager(resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceProductClientListByServiceOptions) *runtime.Pager[WorkspaceProductClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceProductClientListByServiceResponse]{ + More: func(page WorkspaceProductClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceProductClientListByServiceResponse) (WorkspaceProductClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceProductClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceProductClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *WorkspaceProductClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceProductClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.ExpandGroups != nil { + reqQP.Set("expandGroups", strconv.FormatBool(*options.ExpandGroups)) + } + if options != nil && options.Tags != nil { + reqQP.Set("tags", *options.Tags) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *WorkspaceProductClient) listByServiceHandleResponse(resp *http.Response) (WorkspaceProductClientListByServiceResponse, error) { + result := WorkspaceProductClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductCollection); err != nil { + return WorkspaceProductClientListByServiceResponse{}, err + } + return result, nil +} + +// Update - Update existing product details. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - Update parameters. +// - options - WorkspaceProductClientUpdateOptions contains the optional parameters for the WorkspaceProductClient.Update method. +func (client *WorkspaceProductClient) Update(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, ifMatch string, parameters ProductUpdateParameters, options *WorkspaceProductClientUpdateOptions) (WorkspaceProductClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, ifMatch, parameters, options) + if err != nil { + return WorkspaceProductClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceProductClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *WorkspaceProductClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, ifMatch string, parameters ProductUpdateParameters, options *WorkspaceProductClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *WorkspaceProductClient) updateHandleResponse(resp *http.Response) (WorkspaceProductClientUpdateResponse, error) { + result := WorkspaceProductClientUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ProductContract); err != nil { + return WorkspaceProductClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspaceproductapilink_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceproductapilink_client.go new file mode 100644 index 000000000000..6df69e19f32e --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceproductapilink_client.go @@ -0,0 +1,349 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceProductAPILinkClient contains the methods for the WorkspaceProductAPILink group. +// Don't use this type directly, use NewWorkspaceProductAPILinkClient() instead. +type WorkspaceProductAPILinkClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceProductAPILinkClient creates a new instance of WorkspaceProductAPILinkClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceProductAPILinkClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceProductAPILinkClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceProductAPILinkClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceProductAPILinkClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Adds an API to the specified product via link. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - apiLinkID - Product-API link identifier. Must be unique in the current API Management service instance. +// - parameters - Create or update parameters. +// - options - WorkspaceProductAPILinkClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceProductAPILinkClient.CreateOrUpdate +// method. +func (client *WorkspaceProductAPILinkClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, apiLinkID string, parameters ProductAPILinkContract, options *WorkspaceProductAPILinkClientCreateOrUpdateOptions) (WorkspaceProductAPILinkClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, apiLinkID, parameters, options) + if err != nil { + return WorkspaceProductAPILinkClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductAPILinkClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceProductAPILinkClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceProductAPILinkClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, apiLinkID string, parameters ProductAPILinkContract, options *WorkspaceProductAPILinkClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if apiLinkID == "" { + return nil, errors.New("parameter apiLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiLinkId}", url.PathEscape(apiLinkID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceProductAPILinkClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceProductAPILinkClientCreateOrUpdateResponse, error) { + result := WorkspaceProductAPILinkClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductAPILinkContract); err != nil { + return WorkspaceProductAPILinkClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified API from the specified product. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - apiLinkID - Product-API link identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceProductAPILinkClientDeleteOptions contains the optional parameters for the WorkspaceProductAPILinkClient.Delete +// method. +func (client *WorkspaceProductAPILinkClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, apiLinkID string, options *WorkspaceProductAPILinkClientDeleteOptions) (WorkspaceProductAPILinkClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, apiLinkID, options) + if err != nil { + return WorkspaceProductAPILinkClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductAPILinkClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceProductAPILinkClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceProductAPILinkClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceProductAPILinkClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, apiLinkID string, options *WorkspaceProductAPILinkClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if apiLinkID == "" { + return nil, errors.New("parameter apiLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiLinkId}", url.PathEscape(apiLinkID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the API link for the product. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - apiLinkID - Product-API link identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceProductAPILinkClientGetOptions contains the optional parameters for the WorkspaceProductAPILinkClient.Get +// method. +func (client *WorkspaceProductAPILinkClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, apiLinkID string, options *WorkspaceProductAPILinkClientGetOptions) (WorkspaceProductAPILinkClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, apiLinkID, options) + if err != nil { + return WorkspaceProductAPILinkClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductAPILinkClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceProductAPILinkClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceProductAPILinkClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, apiLinkID string, options *WorkspaceProductAPILinkClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if apiLinkID == "" { + return nil, errors.New("parameter apiLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiLinkId}", url.PathEscape(apiLinkID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceProductAPILinkClient) getHandleResponse(resp *http.Response) (WorkspaceProductAPILinkClientGetResponse, error) { + result := WorkspaceProductAPILinkClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ProductAPILinkContract); err != nil { + return WorkspaceProductAPILinkClientGetResponse{}, err + } + return result, nil +} + +// NewListByProductPager - Lists a collection of the API links associated with a product. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceProductAPILinkClientListByProductOptions contains the optional parameters for the WorkspaceProductAPILinkClient.NewListByProductPager +// method. +func (client *WorkspaceProductAPILinkClient) NewListByProductPager(resourceGroupName string, serviceName string, workspaceID string, productID string, options *WorkspaceProductAPILinkClientListByProductOptions) *runtime.Pager[WorkspaceProductAPILinkClientListByProductResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceProductAPILinkClientListByProductResponse]{ + More: func(page WorkspaceProductAPILinkClientListByProductResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceProductAPILinkClientListByProductResponse) (WorkspaceProductAPILinkClientListByProductResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByProductCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceProductAPILinkClientListByProductResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductAPILinkClientListByProductResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceProductAPILinkClientListByProductResponse{}, runtime.NewResponseError(resp) + } + return client.listByProductHandleResponse(resp) + }, + }) +} + +// listByProductCreateRequest creates the ListByProduct request. +func (client *WorkspaceProductAPILinkClient) listByProductCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, options *WorkspaceProductAPILinkClientListByProductOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProductHandleResponse handles the ListByProduct response. +func (client *WorkspaceProductAPILinkClient) listByProductHandleResponse(resp *http.Response) (WorkspaceProductAPILinkClientListByProductResponse, error) { + result := WorkspaceProductAPILinkClientListByProductResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductAPILinkCollection); err != nil { + return WorkspaceProductAPILinkClientListByProductResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspaceproductgrouplink_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceproductgrouplink_client.go new file mode 100644 index 000000000000..305271967b5a --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceproductgrouplink_client.go @@ -0,0 +1,349 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceProductGroupLinkClient contains the methods for the WorkspaceProductGroupLink group. +// Don't use this type directly, use NewWorkspaceProductGroupLinkClient() instead. +type WorkspaceProductGroupLinkClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceProductGroupLinkClient creates a new instance of WorkspaceProductGroupLinkClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceProductGroupLinkClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceProductGroupLinkClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceProductGroupLinkClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceProductGroupLinkClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Adds a group to the specified product via link. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - groupLinkID - Product-Group link identifier. Must be unique in the current API Management service instance. +// - parameters - Create or update parameters. +// - options - WorkspaceProductGroupLinkClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceProductGroupLinkClient.CreateOrUpdate +// method. +func (client *WorkspaceProductGroupLinkClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, groupLinkID string, parameters ProductGroupLinkContract, options *WorkspaceProductGroupLinkClientCreateOrUpdateOptions) (WorkspaceProductGroupLinkClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, groupLinkID, parameters, options) + if err != nil { + return WorkspaceProductGroupLinkClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductGroupLinkClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceProductGroupLinkClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceProductGroupLinkClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, groupLinkID string, parameters ProductGroupLinkContract, options *WorkspaceProductGroupLinkClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if groupLinkID == "" { + return nil, errors.New("parameter groupLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupLinkId}", url.PathEscape(groupLinkID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceProductGroupLinkClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceProductGroupLinkClientCreateOrUpdateResponse, error) { + result := WorkspaceProductGroupLinkClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductGroupLinkContract); err != nil { + return WorkspaceProductGroupLinkClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified group from the specified product. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - groupLinkID - Product-Group link identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceProductGroupLinkClientDeleteOptions contains the optional parameters for the WorkspaceProductGroupLinkClient.Delete +// method. +func (client *WorkspaceProductGroupLinkClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, groupLinkID string, options *WorkspaceProductGroupLinkClientDeleteOptions) (WorkspaceProductGroupLinkClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, groupLinkID, options) + if err != nil { + return WorkspaceProductGroupLinkClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductGroupLinkClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceProductGroupLinkClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceProductGroupLinkClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceProductGroupLinkClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, groupLinkID string, options *WorkspaceProductGroupLinkClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if groupLinkID == "" { + return nil, errors.New("parameter groupLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupLinkId}", url.PathEscape(groupLinkID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the group link for the product. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - groupLinkID - Product-Group link identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceProductGroupLinkClientGetOptions contains the optional parameters for the WorkspaceProductGroupLinkClient.Get +// method. +func (client *WorkspaceProductGroupLinkClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, groupLinkID string, options *WorkspaceProductGroupLinkClientGetOptions) (WorkspaceProductGroupLinkClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, groupLinkID, options) + if err != nil { + return WorkspaceProductGroupLinkClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductGroupLinkClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceProductGroupLinkClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceProductGroupLinkClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, groupLinkID string, options *WorkspaceProductGroupLinkClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if groupLinkID == "" { + return nil, errors.New("parameter groupLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupLinkId}", url.PathEscape(groupLinkID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceProductGroupLinkClient) getHandleResponse(resp *http.Response) (WorkspaceProductGroupLinkClientGetResponse, error) { + result := WorkspaceProductGroupLinkClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ProductGroupLinkContract); err != nil { + return WorkspaceProductGroupLinkClientGetResponse{}, err + } + return result, nil +} + +// NewListByProductPager - Lists a collection of the group links associated with a product. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceProductGroupLinkClientListByProductOptions contains the optional parameters for the WorkspaceProductGroupLinkClient.NewListByProductPager +// method. +func (client *WorkspaceProductGroupLinkClient) NewListByProductPager(resourceGroupName string, serviceName string, workspaceID string, productID string, options *WorkspaceProductGroupLinkClientListByProductOptions) *runtime.Pager[WorkspaceProductGroupLinkClientListByProductResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceProductGroupLinkClientListByProductResponse]{ + More: func(page WorkspaceProductGroupLinkClientListByProductResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceProductGroupLinkClientListByProductResponse) (WorkspaceProductGroupLinkClientListByProductResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByProductCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceProductGroupLinkClientListByProductResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductGroupLinkClientListByProductResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceProductGroupLinkClientListByProductResponse{}, runtime.NewResponseError(resp) + } + return client.listByProductHandleResponse(resp) + }, + }) +} + +// listByProductCreateRequest creates the ListByProduct request. +func (client *WorkspaceProductGroupLinkClient) listByProductCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, options *WorkspaceProductGroupLinkClientListByProductOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProductHandleResponse handles the ListByProduct response. +func (client *WorkspaceProductGroupLinkClient) listByProductHandleResponse(resp *http.Response) (WorkspaceProductGroupLinkClientListByProductResponse, error) { + result := WorkspaceProductGroupLinkClientListByProductResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductGroupLinkCollection); err != nil { + return WorkspaceProductGroupLinkClientListByProductResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspaceproductpolicy_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceproductpolicy_client.go new file mode 100644 index 000000000000..4992b58fffe3 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspaceproductpolicy_client.go @@ -0,0 +1,412 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WorkspaceProductPolicyClient contains the methods for the WorkspaceProductPolicy group. +// Don't use this type directly, use NewWorkspaceProductPolicyClient() instead. +type WorkspaceProductPolicyClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceProductPolicyClient creates a new instance of WorkspaceProductPolicyClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceProductPolicyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceProductPolicyClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceProductPolicyClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceProductPolicyClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates policy configuration for the Product. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - parameters - The policy contents to apply. +// - options - WorkspaceProductPolicyClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceProductPolicyClient.CreateOrUpdate +// method. +func (client *WorkspaceProductPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, policyID PolicyIDName, parameters PolicyContract, options *WorkspaceProductPolicyClientCreateOrUpdateOptions) (WorkspaceProductPolicyClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, policyID, parameters, options) + if err != nil { + return WorkspaceProductPolicyClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductPolicyClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceProductPolicyClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceProductPolicyClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, policyID PolicyIDName, parameters PolicyContract, options *WorkspaceProductPolicyClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceProductPolicyClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceProductPolicyClientCreateOrUpdateResponse, error) { + result := WorkspaceProductPolicyClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { + return WorkspaceProductPolicyClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the policy configuration at the Product. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceProductPolicyClientDeleteOptions contains the optional parameters for the WorkspaceProductPolicyClient.Delete +// method. +func (client *WorkspaceProductPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, policyID PolicyIDName, ifMatch string, options *WorkspaceProductPolicyClientDeleteOptions) (WorkspaceProductPolicyClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, policyID, ifMatch, options) + if err != nil { + return WorkspaceProductPolicyClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductPolicyClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceProductPolicyClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceProductPolicyClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceProductPolicyClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, policyID PolicyIDName, ifMatch string, options *WorkspaceProductPolicyClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the policy configuration at the Product level. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - options - WorkspaceProductPolicyClientGetOptions contains the optional parameters for the WorkspaceProductPolicyClient.Get +// method. +func (client *WorkspaceProductPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, policyID PolicyIDName, options *WorkspaceProductPolicyClientGetOptions) (WorkspaceProductPolicyClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, policyID, options) + if err != nil { + return WorkspaceProductPolicyClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductPolicyClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceProductPolicyClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceProductPolicyClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, policyID PolicyIDName, options *WorkspaceProductPolicyClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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() + if options != nil && options.Format != nil { + reqQP.Set("format", string(*options.Format)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceProductPolicyClient) getHandleResponse(resp *http.Response) (WorkspaceProductPolicyClientGetResponse, error) { + result := WorkspaceProductPolicyClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { + return WorkspaceProductPolicyClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Get the ETag of the policy configuration at the Product level. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - policyID - The identifier of the Policy. +// - options - WorkspaceProductPolicyClientGetEntityTagOptions contains the optional parameters for the WorkspaceProductPolicyClient.GetEntityTag +// method. +func (client *WorkspaceProductPolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, policyID PolicyIDName, options *WorkspaceProductPolicyClientGetEntityTagOptions) (WorkspaceProductPolicyClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, policyID, options) + if err != nil { + return WorkspaceProductPolicyClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductPolicyClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceProductPolicyClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspaceProductPolicyClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, policyID PolicyIDName, options *WorkspaceProductPolicyClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + if policyID == "" { + return nil, errors.New("parameter policyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyId}", url.PathEscape(string(policyID))) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspaceProductPolicyClient) getEntityTagHandleResponse(resp *http.Response) (WorkspaceProductPolicyClientGetEntityTagResponse, error) { + result := WorkspaceProductPolicyClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// ListByProduct - Get the policy configuration at the Product level. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - productID - Product identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceProductPolicyClientListByProductOptions contains the optional parameters for the WorkspaceProductPolicyClient.ListByProduct +// method. +func (client *WorkspaceProductPolicyClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, options *WorkspaceProductPolicyClientListByProductOptions) (WorkspaceProductPolicyClientListByProductResponse, error) { + req, err := client.listByProductCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, productID, options) + if err != nil { + return WorkspaceProductPolicyClientListByProductResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceProductPolicyClientListByProductResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceProductPolicyClientListByProductResponse{}, runtime.NewResponseError(resp) + } + return client.listByProductHandleResponse(resp) +} + +// listByProductCreateRequest creates the ListByProduct request. +func (client *WorkspaceProductPolicyClient) listByProductCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, productID string, options *WorkspaceProductPolicyClientListByProductOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if productID == "" { + return nil, errors.New("parameter productID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productId}", url.PathEscape(productID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProductHandleResponse handles the ListByProduct response. +func (client *WorkspaceProductPolicyClient) listByProductHandleResponse(resp *http.Response) (WorkspaceProductPolicyClientListByProductResponse, error) { + result := WorkspaceProductPolicyClientListByProductResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyCollection); err != nil { + return WorkspaceProductPolicyClientListByProductResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspacesubscription_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspacesubscription_client.go new file mode 100644 index 000000000000..78cab338a57b --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspacesubscription_client.go @@ -0,0 +1,683 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceSubscriptionClient contains the methods for the WorkspaceSubscription group. +// Don't use this type directly, use NewWorkspaceSubscriptionClient() instead. +type WorkspaceSubscriptionClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceSubscriptionClient creates a new instance of WorkspaceSubscriptionClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceSubscriptionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceSubscriptionClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceSubscriptionClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceSubscriptionClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates the subscription of specified user to the specified product. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. +// - parameters - Create parameters. +// - options - WorkspaceSubscriptionClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceSubscriptionClient.CreateOrUpdate +// method. +func (client *WorkspaceSubscriptionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, parameters SubscriptionCreateParameters, options *WorkspaceSubscriptionClientCreateOrUpdateOptions) (WorkspaceSubscriptionClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, sid, parameters, options) + if err != nil { + return WorkspaceSubscriptionClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceSubscriptionClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceSubscriptionClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceSubscriptionClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, parameters SubscriptionCreateParameters, options *WorkspaceSubscriptionClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if sid == "" { + return nil, errors.New("parameter sid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sid}", url.PathEscape(sid)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Notify != nil { + reqQP.Set("notify", strconv.FormatBool(*options.Notify)) + } + reqQP.Set("api-version", "2023-03-01-preview") + if options != nil && options.AppType != nil { + reqQP.Set("appType", string(*options.AppType)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceSubscriptionClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceSubscriptionClientCreateOrUpdateResponse, error) { + result := WorkspaceSubscriptionClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionContract); err != nil { + return WorkspaceSubscriptionClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceSubscriptionClientDeleteOptions contains the optional parameters for the WorkspaceSubscriptionClient.Delete +// method. +func (client *WorkspaceSubscriptionClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, ifMatch string, options *WorkspaceSubscriptionClientDeleteOptions) (WorkspaceSubscriptionClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, sid, ifMatch, options) + if err != nil { + return WorkspaceSubscriptionClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceSubscriptionClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceSubscriptionClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceSubscriptionClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceSubscriptionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, ifMatch string, options *WorkspaceSubscriptionClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if sid == "" { + return nil, errors.New("parameter sid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sid}", url.PathEscape(sid)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified Subscription entity. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. +// - options - WorkspaceSubscriptionClientGetOptions contains the optional parameters for the WorkspaceSubscriptionClient.Get +// method. +func (client *WorkspaceSubscriptionClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, options *WorkspaceSubscriptionClientGetOptions) (WorkspaceSubscriptionClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, sid, options) + if err != nil { + return WorkspaceSubscriptionClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceSubscriptionClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceSubscriptionClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceSubscriptionClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, options *WorkspaceSubscriptionClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if sid == "" { + return nil, errors.New("parameter sid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sid}", url.PathEscape(sid)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceSubscriptionClient) getHandleResponse(resp *http.Response) (WorkspaceSubscriptionClientGetResponse, error) { + result := WorkspaceSubscriptionClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionContract); err != nil { + return WorkspaceSubscriptionClientGetResponse{}, err + } + return result, nil +} + +// GetEntityTag - Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. +// - options - WorkspaceSubscriptionClientGetEntityTagOptions contains the optional parameters for the WorkspaceSubscriptionClient.GetEntityTag +// method. +func (client *WorkspaceSubscriptionClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, options *WorkspaceSubscriptionClientGetEntityTagOptions) (WorkspaceSubscriptionClientGetEntityTagResponse, error) { + req, err := client.getEntityTagCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, sid, options) + if err != nil { + return WorkspaceSubscriptionClientGetEntityTagResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceSubscriptionClientGetEntityTagResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceSubscriptionClientGetEntityTagResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityTagHandleResponse(resp) +} + +// getEntityTagCreateRequest creates the GetEntityTag request. +func (client *WorkspaceSubscriptionClient) getEntityTagCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, options *WorkspaceSubscriptionClientGetEntityTagOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if sid == "" { + return nil, errors.New("parameter sid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sid}", url.PathEscape(sid)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityTagHandleResponse handles the GetEntityTag response. +func (client *WorkspaceSubscriptionClient) getEntityTagHandleResponse(resp *http.Response) (WorkspaceSubscriptionClientGetEntityTagResponse, error) { + result := WorkspaceSubscriptionClientGetEntityTagResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListPager - Lists all subscriptions of the workspace in an API Management service instance. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceSubscriptionClientListOptions contains the optional parameters for the WorkspaceSubscriptionClient.NewListPager +// method. +func (client *WorkspaceSubscriptionClient) NewListPager(resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceSubscriptionClientListOptions) *runtime.Pager[WorkspaceSubscriptionClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceSubscriptionClientListResponse]{ + More: func(page WorkspaceSubscriptionClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceSubscriptionClientListResponse) (WorkspaceSubscriptionClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceSubscriptionClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceSubscriptionClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceSubscriptionClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *WorkspaceSubscriptionClient) listCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceSubscriptionClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *WorkspaceSubscriptionClient) listHandleResponse(resp *http.Response) (WorkspaceSubscriptionClientListResponse, error) { + result := WorkspaceSubscriptionClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionCollection); err != nil { + return WorkspaceSubscriptionClientListResponse{}, err + } + return result, nil +} + +// ListSecrets - Gets the specified Subscription keys. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. +// - options - WorkspaceSubscriptionClientListSecretsOptions contains the optional parameters for the WorkspaceSubscriptionClient.ListSecrets +// method. +func (client *WorkspaceSubscriptionClient) ListSecrets(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, options *WorkspaceSubscriptionClientListSecretsOptions) (WorkspaceSubscriptionClientListSecretsResponse, error) { + req, err := client.listSecretsCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, sid, options) + if err != nil { + return WorkspaceSubscriptionClientListSecretsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceSubscriptionClientListSecretsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceSubscriptionClientListSecretsResponse{}, runtime.NewResponseError(resp) + } + return client.listSecretsHandleResponse(resp) +} + +// listSecretsCreateRequest creates the ListSecrets request. +func (client *WorkspaceSubscriptionClient) listSecretsCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, options *WorkspaceSubscriptionClientListSecretsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/listSecrets" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if sid == "" { + return nil, errors.New("parameter sid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sid}", url.PathEscape(sid)) + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSecretsHandleResponse handles the ListSecrets response. +func (client *WorkspaceSubscriptionClient) listSecretsHandleResponse(resp *http.Response) (WorkspaceSubscriptionClientListSecretsResponse, error) { + result := WorkspaceSubscriptionClientListSecretsResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionKeysContract); err != nil { + return WorkspaceSubscriptionClientListSecretsResponse{}, err + } + return result, nil +} + +// RegeneratePrimaryKey - Regenerates primary key of existing subscription of the workspace in an API Management service instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. +// - options - WorkspaceSubscriptionClientRegeneratePrimaryKeyOptions contains the optional parameters for the WorkspaceSubscriptionClient.RegeneratePrimaryKey +// method. +func (client *WorkspaceSubscriptionClient) RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, options *WorkspaceSubscriptionClientRegeneratePrimaryKeyOptions) (WorkspaceSubscriptionClientRegeneratePrimaryKeyResponse, error) { + req, err := client.regeneratePrimaryKeyCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, sid, options) + if err != nil { + return WorkspaceSubscriptionClientRegeneratePrimaryKeyResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceSubscriptionClientRegeneratePrimaryKeyResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return WorkspaceSubscriptionClientRegeneratePrimaryKeyResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceSubscriptionClientRegeneratePrimaryKeyResponse{}, nil +} + +// regeneratePrimaryKeyCreateRequest creates the RegeneratePrimaryKey request. +func (client *WorkspaceSubscriptionClient) regeneratePrimaryKeyCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, options *WorkspaceSubscriptionClientRegeneratePrimaryKeyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regeneratePrimaryKey" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if sid == "" { + return nil, errors.New("parameter sid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sid}", url.PathEscape(sid)) + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// RegenerateSecondaryKey - Regenerates secondary key of existing subscription of the workspace in an API Management service +// instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. +// - options - WorkspaceSubscriptionClientRegenerateSecondaryKeyOptions contains the optional parameters for the WorkspaceSubscriptionClient.RegenerateSecondaryKey +// method. +func (client *WorkspaceSubscriptionClient) RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, options *WorkspaceSubscriptionClientRegenerateSecondaryKeyOptions) (WorkspaceSubscriptionClientRegenerateSecondaryKeyResponse, error) { + req, err := client.regenerateSecondaryKeyCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, sid, options) + if err != nil { + return WorkspaceSubscriptionClientRegenerateSecondaryKeyResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceSubscriptionClientRegenerateSecondaryKeyResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return WorkspaceSubscriptionClientRegenerateSecondaryKeyResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceSubscriptionClientRegenerateSecondaryKeyResponse{}, nil +} + +// regenerateSecondaryKeyCreateRequest creates the RegenerateSecondaryKey request. +func (client *WorkspaceSubscriptionClient) regenerateSecondaryKeyCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, options *WorkspaceSubscriptionClientRegenerateSecondaryKeyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regenerateSecondaryKey" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if sid == "" { + return nil, errors.New("parameter sid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sid}", url.PathEscape(sid)) + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Update - Updates the details of a subscription specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - sid - Subscription entity Identifier. The entity represents the association between a user and a product in API Management. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - Update parameters. +// - options - WorkspaceSubscriptionClientUpdateOptions contains the optional parameters for the WorkspaceSubscriptionClient.Update +// method. +func (client *WorkspaceSubscriptionClient) Update(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, ifMatch string, parameters SubscriptionUpdateParameters, options *WorkspaceSubscriptionClientUpdateOptions) (WorkspaceSubscriptionClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, sid, ifMatch, parameters, options) + if err != nil { + return WorkspaceSubscriptionClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceSubscriptionClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceSubscriptionClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *WorkspaceSubscriptionClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, sid string, ifMatch string, parameters SubscriptionUpdateParameters, options *WorkspaceSubscriptionClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if sid == "" { + return nil, errors.New("parameter sid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sid}", url.PathEscape(sid)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Notify != nil { + reqQP.Set("notify", strconv.FormatBool(*options.Notify)) + } + reqQP.Set("api-version", "2023-03-01-preview") + if options != nil && options.AppType != nil { + reqQP.Set("appType", string(*options.AppType)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *WorkspaceSubscriptionClient) updateHandleResponse(resp *http.Response) (WorkspaceSubscriptionClientUpdateResponse, error) { + result := WorkspaceSubscriptionClientUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionContract); err != nil { + return WorkspaceSubscriptionClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspacetag_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspacetag_client.go new file mode 100644 index 000000000000..6ac9cbf55d41 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspacetag_client.go @@ -0,0 +1,481 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceTagClient contains the methods for the WorkspaceTag group. +// Don't use this type directly, use NewWorkspaceTagClient() instead. +type WorkspaceTagClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceTagClient creates a new instance of WorkspaceTagClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceTagClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceTagClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceTagClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceTagClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates a tag. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - parameters - Create parameters. +// - options - WorkspaceTagClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceTagClient.CreateOrUpdate +// method. +func (client *WorkspaceTagClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, parameters TagCreateUpdateParameters, options *WorkspaceTagClientCreateOrUpdateOptions) (WorkspaceTagClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, parameters, options) + if err != nil { + return WorkspaceTagClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceTagClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceTagClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, parameters TagCreateUpdateParameters, options *WorkspaceTagClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceTagClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceTagClientCreateOrUpdateResponse, error) { + result := WorkspaceTagClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.TagContract); err != nil { + return WorkspaceTagClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes specific tag of the workspace in an API Management service instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - options - WorkspaceTagClientDeleteOptions contains the optional parameters for the WorkspaceTagClient.Delete method. +func (client *WorkspaceTagClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, ifMatch string, options *WorkspaceTagClientDeleteOptions) (WorkspaceTagClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, ifMatch, options) + if err != nil { + return WorkspaceTagClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceTagClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceTagClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceTagClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, ifMatch string, options *WorkspaceTagClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the details of the tag specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceTagClientGetOptions contains the optional parameters for the WorkspaceTagClient.Get method. +func (client *WorkspaceTagClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, options *WorkspaceTagClientGetOptions) (WorkspaceTagClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, options) + if err != nil { + return WorkspaceTagClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceTagClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceTagClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, options *WorkspaceTagClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceTagClient) getHandleResponse(resp *http.Response) (WorkspaceTagClientGetResponse, error) { + result := WorkspaceTagClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.TagContract); err != nil { + return WorkspaceTagClientGetResponse{}, err + } + return result, nil +} + +// GetEntityState - Gets the entity state version of the tag specified by its identifier. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceTagClientGetEntityStateOptions contains the optional parameters for the WorkspaceTagClient.GetEntityState +// method. +func (client *WorkspaceTagClient) GetEntityState(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, options *WorkspaceTagClientGetEntityStateOptions) (WorkspaceTagClientGetEntityStateResponse, error) { + req, err := client.getEntityStateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, options) + if err != nil { + return WorkspaceTagClientGetEntityStateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagClientGetEntityStateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceTagClientGetEntityStateResponse{}, runtime.NewResponseError(resp) + } + return client.getEntityStateHandleResponse(resp) +} + +// getEntityStateCreateRequest creates the GetEntityState request. +func (client *WorkspaceTagClient) getEntityStateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, options *WorkspaceTagClientGetEntityStateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + 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.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEntityStateHandleResponse handles the GetEntityState response. +func (client *WorkspaceTagClient) getEntityStateHandleResponse(resp *http.Response) (WorkspaceTagClientGetEntityStateResponse, error) { + result := WorkspaceTagClientGetEntityStateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + result.Success = resp.StatusCode >= 200 && resp.StatusCode < 300 + return result, nil +} + +// NewListByServicePager - Lists a collection of tags defined within a workspace in a service instance. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceTagClientListByServiceOptions contains the optional parameters for the WorkspaceTagClient.NewListByServicePager +// method. +func (client *WorkspaceTagClient) NewListByServicePager(resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceTagClientListByServiceOptions) *runtime.Pager[WorkspaceTagClientListByServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceTagClientListByServiceResponse]{ + More: func(page WorkspaceTagClientListByServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceTagClientListByServiceResponse) (WorkspaceTagClientListByServiceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceTagClientListByServiceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagClientListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceTagClientListByServiceResponse{}, runtime.NewResponseError(resp) + } + return client.listByServiceHandleResponse(resp) + }, + }) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *WorkspaceTagClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, options *WorkspaceTagClientListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.Scope != nil { + reqQP.Set("scope", *options.Scope) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *WorkspaceTagClient) listByServiceHandleResponse(resp *http.Response) (WorkspaceTagClientListByServiceResponse, error) { + result := WorkspaceTagClientListByServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagCollection); err != nil { + return WorkspaceTagClientListByServiceResponse{}, err + } + return result, nil +} + +// Update - Updates the details of the tag specified by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - ifMatch - ETag of the Entity. ETag should match the current entity state from the header response of the GET request or +// it should be * for unconditional update. +// - parameters - Update parameters. +// - options - WorkspaceTagClientUpdateOptions contains the optional parameters for the WorkspaceTagClient.Update method. +func (client *WorkspaceTagClient) Update(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, ifMatch string, parameters TagCreateUpdateParameters, options *WorkspaceTagClientUpdateOptions) (WorkspaceTagClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, ifMatch, parameters, options) + if err != nil { + return WorkspaceTagClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceTagClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *WorkspaceTagClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, ifMatch string, parameters TagCreateUpdateParameters, options *WorkspaceTagClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *WorkspaceTagClient) updateHandleResponse(resp *http.Response) (WorkspaceTagClientUpdateResponse, error) { + result := WorkspaceTagClientUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.TagContract); err != nil { + return WorkspaceTagClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspacetagapilink_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspacetagapilink_client.go new file mode 100644 index 000000000000..69d4ac809e48 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspacetagapilink_client.go @@ -0,0 +1,348 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceTagAPILinkClient contains the methods for the WorkspaceTagAPILink group. +// Don't use this type directly, use NewWorkspaceTagAPILinkClient() instead. +type WorkspaceTagAPILinkClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceTagAPILinkClient creates a new instance of WorkspaceTagAPILinkClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceTagAPILinkClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceTagAPILinkClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceTagAPILinkClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceTagAPILinkClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Adds an API to the specified tag via link. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - apiLinkID - Tag-API link identifier. Must be unique in the current API Management service instance. +// - parameters - Create or update parameters. +// - options - WorkspaceTagAPILinkClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceTagAPILinkClient.CreateOrUpdate +// method. +func (client *WorkspaceTagAPILinkClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, apiLinkID string, parameters TagAPILinkContract, options *WorkspaceTagAPILinkClientCreateOrUpdateOptions) (WorkspaceTagAPILinkClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, apiLinkID, parameters, options) + if err != nil { + return WorkspaceTagAPILinkClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagAPILinkClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceTagAPILinkClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceTagAPILinkClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, apiLinkID string, parameters TagAPILinkContract, options *WorkspaceTagAPILinkClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if apiLinkID == "" { + return nil, errors.New("parameter apiLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiLinkId}", url.PathEscape(apiLinkID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceTagAPILinkClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceTagAPILinkClientCreateOrUpdateResponse, error) { + result := WorkspaceTagAPILinkClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagAPILinkContract); err != nil { + return WorkspaceTagAPILinkClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified API from the specified tag. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - apiLinkID - Tag-API link identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceTagAPILinkClientDeleteOptions contains the optional parameters for the WorkspaceTagAPILinkClient.Delete +// method. +func (client *WorkspaceTagAPILinkClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, apiLinkID string, options *WorkspaceTagAPILinkClientDeleteOptions) (WorkspaceTagAPILinkClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, apiLinkID, options) + if err != nil { + return WorkspaceTagAPILinkClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagAPILinkClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceTagAPILinkClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceTagAPILinkClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceTagAPILinkClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, apiLinkID string, options *WorkspaceTagAPILinkClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if apiLinkID == "" { + return nil, errors.New("parameter apiLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiLinkId}", url.PathEscape(apiLinkID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the API link for the tag. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - apiLinkID - Tag-API link identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceTagAPILinkClientGetOptions contains the optional parameters for the WorkspaceTagAPILinkClient.Get method. +func (client *WorkspaceTagAPILinkClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, apiLinkID string, options *WorkspaceTagAPILinkClientGetOptions) (WorkspaceTagAPILinkClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, apiLinkID, options) + if err != nil { + return WorkspaceTagAPILinkClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagAPILinkClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceTagAPILinkClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceTagAPILinkClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, apiLinkID string, options *WorkspaceTagAPILinkClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if apiLinkID == "" { + return nil, errors.New("parameter apiLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiLinkId}", url.PathEscape(apiLinkID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceTagAPILinkClient) getHandleResponse(resp *http.Response) (WorkspaceTagAPILinkClientGetResponse, error) { + result := WorkspaceTagAPILinkClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.TagAPILinkContract); err != nil { + return WorkspaceTagAPILinkClientGetResponse{}, err + } + return result, nil +} + +// NewListByProductPager - Lists a collection of the API links associated with a tag. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceTagAPILinkClientListByProductOptions contains the optional parameters for the WorkspaceTagAPILinkClient.NewListByProductPager +// method. +func (client *WorkspaceTagAPILinkClient) NewListByProductPager(resourceGroupName string, serviceName string, workspaceID string, tagID string, options *WorkspaceTagAPILinkClientListByProductOptions) *runtime.Pager[WorkspaceTagAPILinkClientListByProductResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceTagAPILinkClientListByProductResponse]{ + More: func(page WorkspaceTagAPILinkClientListByProductResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceTagAPILinkClientListByProductResponse) (WorkspaceTagAPILinkClientListByProductResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByProductCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceTagAPILinkClientListByProductResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagAPILinkClientListByProductResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceTagAPILinkClientListByProductResponse{}, runtime.NewResponseError(resp) + } + return client.listByProductHandleResponse(resp) + }, + }) +} + +// listByProductCreateRequest creates the ListByProduct request. +func (client *WorkspaceTagAPILinkClient) listByProductCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, options *WorkspaceTagAPILinkClientListByProductOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProductHandleResponse handles the ListByProduct response. +func (client *WorkspaceTagAPILinkClient) listByProductHandleResponse(resp *http.Response) (WorkspaceTagAPILinkClientListByProductResponse, error) { + result := WorkspaceTagAPILinkClientListByProductResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagAPILinkCollection); err != nil { + return WorkspaceTagAPILinkClientListByProductResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspacetagoperationlink_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspacetagoperationlink_client.go new file mode 100644 index 000000000000..29cbdc457b4d --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspacetagoperationlink_client.go @@ -0,0 +1,349 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceTagOperationLinkClient contains the methods for the WorkspaceTagOperationLink group. +// Don't use this type directly, use NewWorkspaceTagOperationLinkClient() instead. +type WorkspaceTagOperationLinkClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceTagOperationLinkClient creates a new instance of WorkspaceTagOperationLinkClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceTagOperationLinkClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceTagOperationLinkClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceTagOperationLinkClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceTagOperationLinkClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Adds an operation to the specified tag via link. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - operationLinkID - Tag-operation link identifier. Must be unique in the current API Management service instance. +// - parameters - Create or update parameters. +// - options - WorkspaceTagOperationLinkClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceTagOperationLinkClient.CreateOrUpdate +// method. +func (client *WorkspaceTagOperationLinkClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, operationLinkID string, parameters TagOperationLinkContract, options *WorkspaceTagOperationLinkClientCreateOrUpdateOptions) (WorkspaceTagOperationLinkClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, operationLinkID, parameters, options) + if err != nil { + return WorkspaceTagOperationLinkClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagOperationLinkClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceTagOperationLinkClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceTagOperationLinkClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, operationLinkID string, parameters TagOperationLinkContract, options *WorkspaceTagOperationLinkClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if operationLinkID == "" { + return nil, errors.New("parameter operationLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationLinkId}", url.PathEscape(operationLinkID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceTagOperationLinkClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceTagOperationLinkClientCreateOrUpdateResponse, error) { + result := WorkspaceTagOperationLinkClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagOperationLinkContract); err != nil { + return WorkspaceTagOperationLinkClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified operation from the specified tag. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - operationLinkID - Tag-operation link identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceTagOperationLinkClientDeleteOptions contains the optional parameters for the WorkspaceTagOperationLinkClient.Delete +// method. +func (client *WorkspaceTagOperationLinkClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, operationLinkID string, options *WorkspaceTagOperationLinkClientDeleteOptions) (WorkspaceTagOperationLinkClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, operationLinkID, options) + if err != nil { + return WorkspaceTagOperationLinkClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagOperationLinkClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceTagOperationLinkClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceTagOperationLinkClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceTagOperationLinkClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, operationLinkID string, options *WorkspaceTagOperationLinkClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if operationLinkID == "" { + return nil, errors.New("parameter operationLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationLinkId}", url.PathEscape(operationLinkID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the operation link for the tag. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - operationLinkID - Tag-operation link identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceTagOperationLinkClientGetOptions contains the optional parameters for the WorkspaceTagOperationLinkClient.Get +// method. +func (client *WorkspaceTagOperationLinkClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, operationLinkID string, options *WorkspaceTagOperationLinkClientGetOptions) (WorkspaceTagOperationLinkClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, operationLinkID, options) + if err != nil { + return WorkspaceTagOperationLinkClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagOperationLinkClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceTagOperationLinkClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceTagOperationLinkClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, operationLinkID string, options *WorkspaceTagOperationLinkClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if operationLinkID == "" { + return nil, errors.New("parameter operationLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationLinkId}", url.PathEscape(operationLinkID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceTagOperationLinkClient) getHandleResponse(resp *http.Response) (WorkspaceTagOperationLinkClientGetResponse, error) { + result := WorkspaceTagOperationLinkClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.TagOperationLinkContract); err != nil { + return WorkspaceTagOperationLinkClientGetResponse{}, err + } + return result, nil +} + +// NewListByProductPager - Lists a collection of the operation links associated with a tag. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceTagOperationLinkClientListByProductOptions contains the optional parameters for the WorkspaceTagOperationLinkClient.NewListByProductPager +// method. +func (client *WorkspaceTagOperationLinkClient) NewListByProductPager(resourceGroupName string, serviceName string, workspaceID string, tagID string, options *WorkspaceTagOperationLinkClientListByProductOptions) *runtime.Pager[WorkspaceTagOperationLinkClientListByProductResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceTagOperationLinkClientListByProductResponse]{ + More: func(page WorkspaceTagOperationLinkClientListByProductResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceTagOperationLinkClientListByProductResponse) (WorkspaceTagOperationLinkClientListByProductResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByProductCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceTagOperationLinkClientListByProductResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagOperationLinkClientListByProductResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceTagOperationLinkClientListByProductResponse{}, runtime.NewResponseError(resp) + } + return client.listByProductHandleResponse(resp) + }, + }) +} + +// listByProductCreateRequest creates the ListByProduct request. +func (client *WorkspaceTagOperationLinkClient) listByProductCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, options *WorkspaceTagOperationLinkClientListByProductOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProductHandleResponse handles the ListByProduct response. +func (client *WorkspaceTagOperationLinkClient) listByProductHandleResponse(resp *http.Response) (WorkspaceTagOperationLinkClientListByProductResponse, error) { + result := WorkspaceTagOperationLinkClientListByProductResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagOperationLinkCollection); err != nil { + return WorkspaceTagOperationLinkClientListByProductResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/workspacetagproductlink_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/workspacetagproductlink_client.go new file mode 100644 index 000000000000..15da96184263 --- /dev/null +++ b/sdk/resourcemanager/apimanagement/armapimanagement/workspacetagproductlink_client.go @@ -0,0 +1,349 @@ +//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 armapimanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WorkspaceTagProductLinkClient contains the methods for the WorkspaceTagProductLink group. +// Don't use this type directly, use NewWorkspaceTagProductLinkClient() instead. +type WorkspaceTagProductLinkClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkspaceTagProductLinkClient creates a new instance of WorkspaceTagProductLinkClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkspaceTagProductLinkClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceTagProductLinkClient, error) { + cl, err := arm.NewClient(moduleName+".WorkspaceTagProductLinkClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkspaceTagProductLinkClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Adds a product to the specified tag via link. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - productLinkID - Tag-product link identifier. Must be unique in the current API Management service instance. +// - parameters - Create or update parameters. +// - options - WorkspaceTagProductLinkClientCreateOrUpdateOptions contains the optional parameters for the WorkspaceTagProductLinkClient.CreateOrUpdate +// method. +func (client *WorkspaceTagProductLinkClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, productLinkID string, parameters TagProductLinkContract, options *WorkspaceTagProductLinkClientCreateOrUpdateOptions) (WorkspaceTagProductLinkClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, productLinkID, parameters, options) + if err != nil { + return WorkspaceTagProductLinkClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagProductLinkClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkspaceTagProductLinkClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspaceTagProductLinkClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, productLinkID string, parameters TagProductLinkContract, options *WorkspaceTagProductLinkClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if productLinkID == "" { + return nil, errors.New("parameter productLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productLinkId}", url.PathEscape(productLinkID)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkspaceTagProductLinkClient) createOrUpdateHandleResponse(resp *http.Response) (WorkspaceTagProductLinkClientCreateOrUpdateResponse, error) { + result := WorkspaceTagProductLinkClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagProductLinkContract); err != nil { + return WorkspaceTagProductLinkClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified product from the specified tag. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - productLinkID - Tag-product link identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceTagProductLinkClientDeleteOptions contains the optional parameters for the WorkspaceTagProductLinkClient.Delete +// method. +func (client *WorkspaceTagProductLinkClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, productLinkID string, options *WorkspaceTagProductLinkClientDeleteOptions) (WorkspaceTagProductLinkClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, productLinkID, options) + if err != nil { + return WorkspaceTagProductLinkClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagProductLinkClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkspaceTagProductLinkClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return WorkspaceTagProductLinkClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspaceTagProductLinkClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, productLinkID string, options *WorkspaceTagProductLinkClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if productLinkID == "" { + return nil, errors.New("parameter productLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productLinkId}", url.PathEscape(productLinkID)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the product link for the tag. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - productLinkID - Tag-product link identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceTagProductLinkClientGetOptions contains the optional parameters for the WorkspaceTagProductLinkClient.Get +// method. +func (client *WorkspaceTagProductLinkClient) Get(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, productLinkID string, options *WorkspaceTagProductLinkClientGetOptions) (WorkspaceTagProductLinkClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, productLinkID, options) + if err != nil { + return WorkspaceTagProductLinkClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagProductLinkClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceTagProductLinkClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspaceTagProductLinkClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, productLinkID string, options *WorkspaceTagProductLinkClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + if productLinkID == "" { + return nil, errors.New("parameter productLinkID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{productLinkId}", url.PathEscape(productLinkID)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspaceTagProductLinkClient) getHandleResponse(resp *http.Response) (WorkspaceTagProductLinkClientGetResponse, error) { + result := WorkspaceTagProductLinkClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.TagProductLinkContract); err != nil { + return WorkspaceTagProductLinkClientGetResponse{}, err + } + return result, nil +} + +// NewListByProductPager - Lists a collection of the product links associated with a tag. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serviceName - The name of the API Management service. +// - workspaceID - Workspace identifier. Must be unique in the current API Management service instance. +// - tagID - Tag identifier. Must be unique in the current API Management service instance. +// - options - WorkspaceTagProductLinkClientListByProductOptions contains the optional parameters for the WorkspaceTagProductLinkClient.NewListByProductPager +// method. +func (client *WorkspaceTagProductLinkClient) NewListByProductPager(resourceGroupName string, serviceName string, workspaceID string, tagID string, options *WorkspaceTagProductLinkClientListByProductOptions) *runtime.Pager[WorkspaceTagProductLinkClientListByProductResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkspaceTagProductLinkClientListByProductResponse]{ + More: func(page WorkspaceTagProductLinkClientListByProductResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkspaceTagProductLinkClientListByProductResponse) (WorkspaceTagProductLinkClientListByProductResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByProductCreateRequest(ctx, resourceGroupName, serviceName, workspaceID, tagID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkspaceTagProductLinkClientListByProductResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkspaceTagProductLinkClientListByProductResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspaceTagProductLinkClientListByProductResponse{}, runtime.NewResponseError(resp) + } + return client.listByProductHandleResponse(resp) + }, + }) +} + +// listByProductCreateRequest creates the ListByProduct request. +func (client *WorkspaceTagProductLinkClient) listByProductCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, workspaceID string, tagID string, options *WorkspaceTagProductLinkClientListByProductOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if workspaceID == "" { + return nil, errors.New("parameter workspaceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceId}", url.PathEscape(workspaceID)) + if tagID == "" { + return nil, errors.New("parameter tagID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagId}", url.PathEscape(tagID)) + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProductHandleResponse handles the ListByProduct response. +func (client *WorkspaceTagProductLinkClient) listByProductHandleResponse(resp *http.Response) (WorkspaceTagProductLinkClientListByProductResponse, error) { + result := WorkspaceTagProductLinkClientListByProductResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagProductLinkCollection); err != nil { + return WorkspaceTagProductLinkClientListByProductResponse{}, err + } + return result, nil +}